diff options
author | 1999-02-25 22:10:12 +0000 | |
---|---|---|
committer | 1999-02-25 22:10:12 +0000 | |
commit | 30476ae41ad5176c2dd4273154de3bd2356969db (patch) | |
tree | f207cc5f841f00d667f95e7b063b892947ade1d5 /lib/libc/gen/setproctitle.c | |
parent | mib for pf_key is PF_KEY not PF_KEY_V2 (diff) | |
download | wireguard-openbsd-30476ae41ad5176c2dd4273154de3bd2356969db.tar.xz wireguard-openbsd-30476ae41ad5176c2dd4273154de3bd2356969db.zip |
Don't segfault when sysctl fails
Diffstat (limited to 'lib/libc/gen/setproctitle.c')
-rw-r--r-- | lib/libc/gen/setproctitle.c | 5 |
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; |