libc: make posix_spawn(3) clean up child on failure

Change-Id: I39a321f23326485fca789e5792a57532d1036716
This commit is contained in:
David van Moolenbroek 2016-12-20 14:46:42 +00:00
parent b52b83f927
commit 1bb466dd36

View File

@ -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;