From bc9bc9192752cf4329830199107c64ea9c65d542 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 5 Apr 2022 22:56:51 +0200 Subject: Use _exit instead of exit on program exec error --- TODO | 3 ++- src/program.c | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/TODO b/TODO index 850769b..0fc4238 100644 --- a/TODO +++ b/TODO @@ -7,4 +7,5 @@ Verify path lengths. Currently there is limit to 255 characters for remote names Deal with replacing of / with _. Handle strdup failure. Make downloading manga asynchronous, just like torrents. And have timeout for download. -Detect if a website is very slow (timeout?) and ignore sync for that website for the current sync. This is to prevent a slow website from preventing all syncs. +Detect if a website is very slow (timeout?) and ignore sync for that website for the current sync. This is to prevent a slow website from preventing all syncs.. +Cleanup command should remove torrents from transmission. 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; -- cgit v1.2.3