summaryrefslogtreecommitdiff
path: root/lib/libc/gen
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>1999-02-25 22:10:13 +0000
committerArtur Grabowski <art@cvs.openbsd.org>1999-02-25 22:10:13 +0000
commit4e7eb8b94cb94d893993149b4a66a39ea9929f71 (patch)
tree5dca3e11de6d8162f562e3bd4878e6b26c110c13 /lib/libc/gen
parent07c3ccc525f2bac58e4632bde3a386e185b0a195 (diff)
Don't segfault when sysctl fails
Diffstat (limited to 'lib/libc/gen')
-rw-r--r--lib/libc/gen/setproctitle.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libc/gen/setproctitle.c b/lib/libc/gen/setproctitle.c
index 765cdeae056..65ec831c66c 100644
--- a/lib/libc/gen/setproctitle.c
+++ b/lib/libc/gen/setproctitle.c
@@ -30,7 +30,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: setproctitle.c,v 1.6 1998/06/23 22:40:27 millert Exp $";
+static char rcsid[] = "$OpenBSD: setproctitle.c,v 1.7 1999/02/25 22:10:12 art Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
@@ -90,7 +90,8 @@ setproctitle(fmt, va_alist)
mib[0] = CTL_VM;
mib[1] = VM_PSSTRINGS;
len = sizeof(_ps);
- sysctl(mib, 2, &_ps, &len, NULL, 0);
+ if (sysctl(mib, 2, &_ps, &len, NULL, 0) != 0)
+ return;
ps = (struct ps_strings *)_ps.val;
}
ps->ps_nargvstr = 1;