diff options
author | cvs2svn <cvs2svn@FreeBSD.org> | 1999-01-21 00:55:32 +0000 |
---|---|---|
committer | cvs2svn <cvs2svn@FreeBSD.org> | 1999-01-21 00:55:32 +0000 |
commit | 76b5366091f76c9bc73570149ef5055648fc2c39 (patch) | |
tree | 590d020e0f2a5bea6e09d66d951a674443b21d67 /lib/libutil/setproctitle.c | |
parent | 4b4d01da6f07f7754ff6a6e4f5223e9f0984d1a6 (diff) |
Notes
Diffstat (limited to 'lib/libutil/setproctitle.c')
-rw-r--r-- | lib/libutil/setproctitle.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/libutil/setproctitle.c b/lib/libutil/setproctitle.c index 3bce42074da8..217df06ac8c0 100644 --- a/lib/libutil/setproctitle.c +++ b/lib/libutil/setproctitle.c @@ -14,7 +14,7 @@ * 3. Absolutely no warranty of function or purpose is made by the author * Peter Wemm. * - * $Id: setproctitle.c,v 1.7 1998/04/28 07:02:33 dg Exp $ + * $Id: setproctitle.c,v 1.6 1998/04/28 06:59:14 dg Exp $ */ #include <sys/types.h> @@ -72,8 +72,8 @@ setproctitle(fmt, va_alist) static char buf[SPT_BUFSIZE]; static char *ps_argv[2]; va_list ap; + int mib[2]; size_t len; - unsigned long ul_ps_strings; #if defined(__STDC__) va_start(ap, fmt); @@ -104,11 +104,12 @@ setproctitle(fmt, va_alist) va_end(ap); if (ps_strings == NULL) { - len = sizeof(ul_ps_strings); - if (sysctlbyname("kern.ps_strings", &ul_ps_strings, &len, NULL, - 0) == -1) - ul_ps_strings = PS_STRINGS; - ps_strings = (struct ps_strings *)ul_ps_strings; + mib[0] = CTL_KERN; + mib[1] = KERN_PS_STRINGS; + len = sizeof(ps_strings); + if (sysctl(mib, 2, &ps_strings, &len, NULL, 0) < 0 || + ps_strings == NULL) + ps_strings = PS_STRINGS; } /* PS_STRINGS points to zeroed memory on a style #2 kernel */ |