summaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/util.c b/src/util.c
index 805d47afb4..a3d6b49710 100644
--- a/src/util.c
+++ b/src/util.c
@@ -3101,12 +3101,14 @@ char *unquote(const char *s, const char quote) {
return strdup(s);
}
-int waitpid_loop(pid_t pid, int *status) {
+int wait_for_terminate(pid_t pid, siginfo_t *status) {
assert(pid >= 1);
assert(status);
for (;;) {
- if (waitpid(pid, status, 0) < 0) {
+ zero(*status);
+
+ if (waitid(P_PID, pid, status, WEXITED) < 0) {
if (errno == EINTR)
continue;