summaryrefslogtreecommitdiff
path: root/usr.bin/w/w.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2015-01-16 06:40:24 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2015-01-16 06:40:24 +0000
commit315054f4737a39489e0a14f3a92bff61f1592832 (patch)
tree62bf010653374ce09b6beb4dfa0414a91457233b /usr.bin/w/w.c
parent79e3d817585ca08a91e30ad14abe43e2ab70295f (diff)
Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where sensible to avoid pulling in the pollution. These are the files confirmed through binary verification. ok guenther, millert, doug (helped with the verification protocol)
Diffstat (limited to 'usr.bin/w/w.c')
-rw-r--r--usr.bin/w/w.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.bin/w/w.c b/usr.bin/w/w.c
index 2847004aa45..08f6b951528 100644
--- a/usr.bin/w/w.c
+++ b/usr.bin/w/w.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: w.c,v 1.56 2014/07/08 23:24:28 deraadt Exp $ */
+/* $OpenBSD: w.c,v 1.57 2015/01/16 06:40:14 deraadt Exp $ */
/*-
* Copyright (c) 1980, 1991, 1993, 1994
@@ -35,10 +35,11 @@
* This program is similar to the systat command on Tenex/Tops 10/20
*
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MAXCOMLEN */
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/sysctl.h>
+#include <sys/signal.h>
#include <sys/proc.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
@@ -77,7 +78,7 @@ int header = 1; /* true if -h flag: don't print heading */
int nflag = 1; /* true if -n flag: don't convert addrs */
int sortidle; /* sort by idle time */
char *sel_user; /* login of particular user selected */
-char domain[MAXHOSTNAMELEN];
+char domain[HOST_NAME_MAX+1];
#define NAME_WIDTH 8
#define HOST_WIDTH 16
@@ -110,7 +111,7 @@ main(int argc, char *argv[])
struct in_addr addr;
int ch, i, nentries, nusers, wcmd;
char *memf, *nlistf, *p, *x;
- char buf[MAXHOSTNAMELEN], errbuf[_POSIX2_LINE_MAX];
+ char buf[HOST_NAME_MAX+1], errbuf[_POSIX2_LINE_MAX];
/* Are we w(1) or uptime(1)? */
p = __progname;