libbb: spawn should remove child which failed to exec
authorDenys Vlasenko <vda.linux@googlemail.com>
Thu, 3 Feb 2011 13:14:09 +0000 (14:14 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Thu, 3 Feb 2011 13:14:09 +0000 (14:14 +0100)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
libbb/vfork_daemon_rexec.c

index af938bed3b732bea371640894ac3342505197849..a75eafbd3e96def9552a4b5386637d6081cfce57 100644 (file)
@@ -52,6 +52,7 @@ pid_t FAST_FUNC spawn(char **argv)
         * Interested party can wait on pid and learn exit code.
         * If 111 - then it (most probably) failed to exec */
        if (failed) {
+               safe_waitpid(pid, NULL, 0); /* prevent zombie */
                errno = failed;
                return -1;
        }