From e34dbf9e669f1761815ba16983802d02cefe9cc3 Mon Sep 17 00:00:00 2001 From: Miod Vallat Date: Thu, 1 May 2008 21:18:14 +0000 Subject: 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@ --- usr.bin/pmdb/pmdb.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 * 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)) { -- cgit v1.2.3