From a83d1d59bf40ce9282bc347ddcd3cec585c3d254 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Fri, 14 Oct 2022 23:43:26 -0500 Subject: [PATCH] Some waitpid() failures (such as bad PID) don't set status, so return 127. --- lib/xwrap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/xwrap.c b/lib/xwrap.c index 4f764199..3c89557c 100644 --- a/lib/xwrap.c +++ b/lib/xwrap.c @@ -339,7 +339,7 @@ pid_t xpopen_both(char **argv, int *pipes) // Wait for child process to exit, then return adjusted exit code. int xwaitpid(pid_t pid) { - int status; + int status = 127; while (-1 == waitpid(pid, &status, 0) && errno == EINTR) errno = 0; -- 2.39.2