Use _exit instead of exit if exec() fails after forking

* Otherwise if we call exit() it can ruin the parent process by calling
  atexit(), signal handlers, and other things.
This commit is contained in:
baldurk
2017-08-02 15:30:33 +01:00
parent 9878223839
commit 1708bee968
+2 -4
View File
@@ -369,10 +369,8 @@ static pid_t RunProcess(const char *app, const char *workingDir, const char *cmd
chdir(workDir.c_str());
execve(appPath.c_str(), argv, envp);
RDCERR("Failed to execute '%s' %s", appName.c_str(), strerror(errno));
RDCERR("Full Path: '%s'", appPath.c_str());
exit(0);
fprintf(stderr, "exec failed\n");
_exit(1);
}
}