Use _exit() instead of exit() in child process
exit() should not be called from within a child process, since it would
call functions registered with atexit(), and flush stdio streams. Use
_exit() instead.
@@ -14,7 +14,7 @@ pid_t cmd_execute(const char *path, const char *const argv[]) {
if (pid == 0) {
execvp(path, (char *const *)argv);
perror("exec");
- exit(1);
+ _exit(1);
}
return pid;
}
