From: David van Moolenbroek Date: Tue, 20 Dec 2016 14:46:42 +0000 (+0000) Subject: libc: make posix_spawn(3) clean up child on failure X-Git-Url: http://zhaoyanbai.com/repos/Bv9ARM.ch01.html?a=commitdiff_plain;h=1bb466dd36c0591122401dfd685782ec28865fc3;p=minix.git libc: make posix_spawn(3) clean up child on failure Change-Id: I39a321f23326485fca789e5792a57532d1036716 --- diff --git a/minix/lib/libc/sys/posix_spawn.c b/minix/lib/libc/sys/posix_spawn.c index 0141fcafe..467fd5989 100644 --- a/minix/lib/libc/sys/posix_spawn.c +++ b/minix/lib/libc/sys/posix_spawn.c @@ -265,6 +265,9 @@ posix_spawn(pid_t * __restrict pid, const char * __restrict path, error = errno; close(pfd[0]); + if (error != 0) + (void)waitpid(p, NULL, 0); + if (pid != NULL) *pid = p; return error;