diff options
author | 2018-06-12 01:58:05 +0000 | |
---|---|---|
committer | 2018-06-12 01:58:05 +0000 | |
commit | fe96ca7885ad62fe69f9eb586a6f8535d4c96f52 (patch) | |
tree | 4ddeb3dfcb15ca4c8443e1f84719b010304f5cfe | |
parent | Fix RAMDISK build by removing an #ifdef INET6 in tcp_trace(). (diff) | |
download | wireguard-openbsd-fe96ca7885ad62fe69f9eb586a6f8535d4c96f52.tar.xz wireguard-openbsd-fe96ca7885ad62fe69f9eb586a6f8535d4c96f52.zip |
handle the seperation of kvm_getenvv() and kvm_getargv() more cleanly
ok kettenis, plus a fix from tb
-rw-r--r-- | bin/ps/print.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/bin/ps/print.c b/bin/ps/print.c index 28e0741f8c6..14e8ad24de4 100644 --- a/bin/ps/print.c +++ b/bin/ps/print.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print.c,v 1.69 2016/09/08 15:11:29 tedu Exp $ */ +/* $OpenBSD: print.c,v 1.70 2018/06/12 01:58:05 deraadt Exp $ */ /* $NetBSD: print.c,v 1.27 1995/09/29 21:58:12 cgd Exp $ */ /*- @@ -97,7 +97,7 @@ command(const struct kinfo_proc *kp, VARENT *ve) { VAR *v; int left, wantspace = 0; - char **argv, **p; + char **p; /* * Determine the available number of display columns. @@ -118,8 +118,8 @@ command(const struct kinfo_proc *kp, VARENT *ve) left = INT_MAX; if (needenv && kd != NULL) { - argv = kvm_getenvv(kd, kp, termwidth); - if ((p = argv) != NULL) { + char **envp = kvm_getenvv(kd, kp, termwidth); + if ((p = envp) != NULL) { while (*p) { if (wantspace) { putchar(' '); @@ -132,11 +132,12 @@ command(const struct kinfo_proc *kp, VARENT *ve) wantspace = 1; } } - } else - argv = NULL; + } if (needcomm) { if (!commandonly) { + char **argv = NULL; + if (kd != NULL) { argv = kvm_getargv(kd, kp, termwidth); if ((p = argv) != NULL) { |