summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2017-08-22 15:47:13 +0000
committerderaadt <deraadt@openbsd.org>2017-08-22 15:47:13 +0000
commitb10e1c6c637ab88c7b94d9fd506e6b18f6a63410 (patch)
tree8430ad18029cca939fe0f26f0cb5be0e3cd5524d
parentUse a boolean variable to remember the quotation level instead of (diff)
downloadwireguard-openbsd-b10e1c6c637ab88c7b94d9fd506e6b18f6a63410.tar.xz
wireguard-openbsd-b10e1c6c637ab88c7b94d9fd506e6b18f6a63410.zip
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
-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;
}