aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2022-04-05 22:56:51 +0200
committerdec05eba <dec05eba@protonmail.com>2022-04-05 22:56:51 +0200
commitbc9bc9192752cf4329830199107c64ea9c65d542 (patch)
tree4e23df1b493f77f5bf7c9301ee1f9513199029f1
parent0145b7d91c3529415928868f024330ba23d2b9b3 (diff)
Use _exit instead of exit on program exec error
-rw-r--r--TODO3
-rw-r--r--src/program.c12
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;