diff options
Diffstat (limited to 'lib/libc/gen')
-rw-r--r-- | lib/libc/gen/posix_spawn.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/libc/gen/posix_spawn.c b/lib/libc/gen/posix_spawn.c index e4ceb20..e3124b2 100644 --- a/lib/libc/gen/posix_spawn.c +++ b/lib/libc/gen/posix_spawn.c @@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$"); #include "namespace.h" #include <sys/queue.h> +#include <sys/wait.h> #include <errno.h> #include <fcntl.h> @@ -216,7 +217,9 @@ do_posix_spawn(pid_t *pid, const char *path, error = errno; _exit(127); default: - if (pid != NULL) + if (error != 0) + _waitpid(p, NULL, WNOHANG); + else if (pid != NULL) *pid = p; return (error); } |