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

Change-Id: I39a321f23326485fca789e5792a57532d1036716
This commit is contained in:
David van Moolenbroek
2016-12-28 13:05:55 +00:00
parent b52b83f927
commit 1bb466dd36
+3
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;