diff options
| author | 2015-01-16 06:39:28 +0000 | |
|---|---|---|
| committer | 2015-01-16 06:39:28 +0000 | |
| commit | b9fc9a728fce9c4289b7e9a992665e28d5629a54 (patch) | |
| tree | 72b2433e418dfa1aef5fcf8305617b97979a25d8 /bin/ps/print.c | |
| parent | improve checksum parsing slightly. now handles filenames with spaces. (diff) | |
| download | wireguard-openbsd-b9fc9a728fce9c4289b7e9a992665e28d5629a54.tar.xz wireguard-openbsd-b9fc9a728fce9c4289b7e9a992665e28d5629a54.zip | |
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 'bin/ps/print.c')
| -rw-r--r-- | bin/ps/print.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/bin/ps/print.c b/bin/ps/print.c index 3ffd499f239..3c22518397e 100644 --- a/bin/ps/print.c +++ b/bin/ps/print.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print.c,v 1.58 2014/08/16 16:38:38 tedu Exp $ */ +/* $OpenBSD: print.c,v 1.59 2015/01/16 06:39:32 deraadt Exp $ */ /* $NetBSD: print.c,v 1.27 1995/09/29 21:58:12 cgd Exp $ */ /*- @@ -30,7 +30,8 @@ * SUCH DAMAGE. */ -#include <sys/param.h> +#include <sys/param.h> /* MAXCOMLEN PZERO NODEV */ +#include <sys/types.h> #include <sys/proc.h> #include <sys/stat.h> @@ -47,6 +48,7 @@ #include <string.h> #include <tzfile.h> #include <unistd.h> +#include <limits.h> #include <pwd.h> #include "ps.h" @@ -180,7 +182,7 @@ curwd(const struct kinfo_proc *kp, VARENT *ve) { VAR *v; int name[] = { CTL_KERN, KERN_PROC_CWD, kp->p_pid }; - char path[MAXPATHLEN]; + char path[PATH_MAX]; size_t pathlen = sizeof path; if (!kvm_sysctl_only || sysctl(name, 3, path, &pathlen, NULL, 0) != 0) @@ -197,7 +199,7 @@ logname(const struct kinfo_proc *kp, VARENT *ve) v = ve->var; if (kp->p_login[0]) { - int n = min(v->width, MAXLOGNAME); + int n = min(v->width, LOGIN_NAME_MAX); (void)printf("%-*.*s", n, n, kp->p_login); if (v->width > n) (void)printf("%*s", v->width - n, ""); |
