summaryrefslogtreecommitdiff
path: root/usr.bin/pmdb
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2008-05-01 21:18:14 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2008-05-01 21:18:14 +0000
commite34dbf9e669f1761815ba16983802d02cefe9cc3 (patch)
tree5b659a34e19fd5663bffdc355437416c9ddd6354 /usr.bin/pmdb
parenta889b94e4da0d0640d5168711d6a48c3ce71085e (diff)
In the main loop, do not call wait() if there is no child process yet;
misinterpreting the ``returned'' status could lead to segfauts, as reported by ``Filth'' (hygdrasil, gmail dot com) ok deraadt@
Diffstat (limited to 'usr.bin/pmdb')
-rw-r--r--usr.bin/pmdb/pmdb.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.bin/pmdb/pmdb.c b/usr.bin/pmdb/pmdb.c
index 70f032d452c..d3ac2763a4e 100644
--- a/usr.bin/pmdb/pmdb.c
+++ b/usr.bin/pmdb/pmdb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmdb.c,v 1.21 2007/08/06 19:16:05 sobrado Exp $ */
+/* $OpenBSD: pmdb.c,v 1.22 2008/05/01 21:18:13 miod Exp $ */
/*
* Copyright (c) 2002 Artur Grabowski <art@openbsd.org>
* All rights reserved.
@@ -186,6 +186,9 @@ main(int argc, char **argv)
if (ps.ps_state == TERMINATED)
break;
+ if (ps.ps_state == NONE || ps.ps_state == LOADED)
+ continue;
+
if (wait(&status) == 0)
err(1, "wait");
if (WIFEXITED(status)) {