diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2002-01-30 17:52:41 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2002-01-30 17:52:41 +0000 |
commit | 3f6f4cddbfbd8741fd5f41b841a59c16728bafc1 (patch) | |
tree | 2e5ce4d943d6ae429ecdbeef22e77c9241ca6994 /bin/ps/ps.c | |
parent | aa7bad31c0be209909d7d67e47d02a03e85dee89 (diff) |
right, just check more for nulls; from Dan Harnett <danh@wzrd.com>
Diffstat (limited to 'bin/ps/ps.c')
-rw-r--r-- | bin/ps/ps.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/bin/ps/ps.c b/bin/ps/ps.c index 2ec97eff64f..16cea0d3162 100644 --- a/bin/ps/ps.c +++ b/bin/ps/ps.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ps.c,v 1.24 2002/01/30 17:02:55 mickey Exp $ */ +/* $OpenBSD: ps.c,v 1.25 2002/01/30 17:52:40 mickey Exp $ */ /* $NetBSD: ps.c,v 1.15 1995/05/18 20:33:25 mycroft Exp $ */ /*- @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)ps.c 8.4 (Berkeley) 4/2/94"; #else -static char rcsid[] = "$OpenBSD: ps.c,v 1.24 2002/01/30 17:02:55 mickey Exp $"; +static char rcsid[] = "$OpenBSD: ps.c,v 1.25 2002/01/30 17:52:40 mickey Exp $"; #endif #endif /* not lint */ @@ -286,7 +286,7 @@ main(argc, argv) } kd = kvm_openfiles(nlistf, memf, swapf, O_RDONLY, errbuf); - if (kd == NULL) + if (kd == NULL && (nlistf != NULL || memf != NULL || swapf != NULL)) errx(1, "%s", errbuf); setegid(getgid()); @@ -420,7 +420,7 @@ saveuser(ki) struct usave *usp; usp = &ki->ki_u; - if (kvm_read(kd, (u_long)&KI_PROC(ki)->p_addr->u_stats, + if (kd != NULL && kvm_read(kd, (u_long)&KI_PROC(ki)->p_addr->u_stats, &pstats, sizeof(pstats)) == sizeof(pstats)) { /* * The u-area might be swapped out, and we can't get |