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/%22http:/www.isc.org/icons/zlib_tech.html?a=commitdiff_plain;h=refs%2Fchanges%2F81%2F3381%2F1;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;