Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3c56454c authored by Mike Kasick's avatar Mike Kasick Committed by Ricardo Cerqueira
Browse files

init: Don't confuse do_exec with other exiting processes.

The waitpid call in do_exec may return early with EINTR when init receives
a signal, e.g., a SIGCHLD from an exiting service process.  do_exec should
check waitpid for an EINTR "error", to ensure that it returns only after
waiting on its child process.
parent abe57d0b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -269,7 +269,7 @@ int do_exec(int nargs, char **args)
    }
    else
    {
        waitpid(pid, &status, 0);
        while (waitpid(pid, &status, 0) == -1 && errno == EINTR);
        if (WEXITSTATUS(status) != 0) {
            ERROR("exec: pid %1d exited with return code %d: %s", (int)pid, WEXITSTATUS(status), strerror(status));
        }