summaryrefslogtreecommitdiff
path: root/usr.sbin/rebound/rebound.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2017-08-22 15:47:14 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2017-08-22 15:47:14 +0000
commit6ac6d381146147a186c6015a4141f92963db30e6 (patch)
tree125755f01b9186c3ea782bde4915acf851a3f900 /usr.sbin/rebound/rebound.c
parent325ad0a702ccdec35dc8c419b15fe95572421158 (diff)
Use waitpid()/EINTR idiom for the specific pid, rather than generic wait(),
in case the parent process was started with a dangling child. This style ensures any potential parent:child interlock isn't disrupted due to the "wrong" child being waited on first. Then the other other childs can safely zombie. ok millert jca brynet
Diffstat (limited to 'usr.sbin/rebound/rebound.c')
-rw-r--r--usr.sbin/rebound/rebound.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.sbin/rebound/rebound.c b/usr.sbin/rebound/rebound.c
index 782f735f622..63688d5bf90 100644
--- a/usr.sbin/rebound/rebound.c
+++ b/usr.sbin/rebound/rebound.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rebound.c,v 1.90 2017/08/12 00:24:13 tedu Exp $ */
+/* $OpenBSD: rebound.c,v 1.91 2017/08/22 15:47:13 deraadt Exp $ */
/*
* Copyright (c) 2015 Ted Unangst <tedu@openbsd.org>
*
@@ -958,7 +958,10 @@ monitorloop(int ud, int ld, int ud6, int ld6, const char *confname)
}
}
doublebreak:
- wait(NULL);
+ while (waitpid(child, NULL, 0) == -1) {
+ if (errno != EINTR)
+ break;
+ }
}
return 1;
}