diff options
author | dec05eba <dec05eba@protonmail.com> | 2022-04-05 22:56:51 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2022-04-05 22:56:51 +0200 |
commit | bc9bc9192752cf4329830199107c64ea9c65d542 (patch) | |
tree | 4e23df1b493f77f5bf7c9301ee1f9513199029f1 /src | |
parent | 0145b7d91c3529415928868f024330ba23d2b9b3 (diff) |
Use _exit instead of exit on program exec error
Diffstat (limited to 'src')
-rw-r--r-- | src/program.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/program.c b/src/program.c index 56f65c1..49a92a3 100644 --- a/src/program.c +++ b/src/program.c @@ -73,12 +73,12 @@ int program_exec(const char **args, ProgramOutputCallback output_callback, void } else if(pid == 0) { /* child */ if(prctl(PR_SET_PDEATHSIG, SIGTERM) == -1) { perror("prctl(PR_SET_PDEATHSIG, SIGTERM) failed"); - exit(127); + _exit(127); } /* Test if the parent died before the above call to prctl */ if(getppid() != parent_pid) - exit(127); + _exit(127); dup2(fd[WRITE_END], STDOUT_FILENO); close(fd[READ_END]); @@ -86,7 +86,7 @@ int program_exec(const char **args, ProgramOutputCallback output_callback, void execvp(args[0], (char* const*)args); perror("execvp"); - exit(127); + _exit(127); } else { /* parent */ close(fd[WRITE_END]); @@ -146,12 +146,12 @@ int program_exec_async(const char **args, int *process_id, int *stdin_file, int } else if(pid == 0) { /* child */ if(prctl(PR_SET_PDEATHSIG, SIGTERM) == -1) { perror("prctl(PR_SET_PDEATHSIG, SIGTERM) failed"); - exit(127); + _exit(127); } /* Test if the parent died before the above call to prctl */ if(getppid() != parent_pid) - exit(127); + _exit(127); if(stdin_file) { dup2(stdin_fd[READ_END], STDIN_FILENO); @@ -167,7 +167,7 @@ int program_exec_async(const char **args, int *process_id, int *stdin_file, int execvp(args[0], (char* const*)args); perror("execvp"); - exit(127); + _exit(127); } else { /* parent */ if(process_id) *process_id = pid; |