commit 109417b5defcd6d13c54b213c4f06272fcf0dc19
parent 28e09b5eb76919122f8baf57899154b3dd5fdaa0
Author: Laurent Bercot <ska-skaware@skarnet.org>
Date: Thu, 29 Jun 2023 07:55:12 +0000
posix_spawn workaround fixes
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat:
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/libstddjb/child_spawn_workaround.c b/src/libstddjb/child_spawn_workaround.c
@@ -25,7 +25,7 @@ pid_t child_spawn_workaround (pid_t pid, int const *p)
if (r == -1) return 0 ;
if (r) return (errno = EILSEQ, 0) ; /* child wrote, wtf */
- do e = waitid(P_PID, pid, &si, WNOHANG | WNOWAIT) ;
+ do e = waitid(P_PID, pid, &si, WEXITED | WNOHANG | WNOWAIT) ;
while (e == -1 && errno == EINTR) ;
if (e == -1) return pid ; /* we're in trouble, but don't leak a child */
if (!si.si_pid) return pid ; /* child is running */
diff --git a/src/sysdeps/tryposixspawnearlyreturn.c b/src/sysdeps/tryposixspawnearlyreturn.c
@@ -19,6 +19,6 @@ int main (void)
e = posix_spawnattr_setflags(&attr, 0) ;
if (e) return 111 ;
if (close(fd) == -1 || unlink(tmp) == -1) return 111 ;
- e = posix_spawn(0, argv[0], 0, &attrp, argv, &env) ;
+ e = posix_spawn(0, argv[0], 0, &attr, argv, &env) ;
return e ? e == ENOENT ? 1 : 111 : 0 ;
}