diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-07-05 19:22:23 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-07-11 21:00:35 +0200 |
commit | 9d71f913744ab567a49195a43c525c0d494fe084 (patch) | |
tree | b485cc59539e5e0ebd635465b7ccd47c5d2351fd /src | |
parent | b184475290e204bdcfd833d34939440c4a81430b (diff) |
Prepare for imagemagick removal, use vfork instead of fork
Diffstat (limited to 'src')
-rw-r--r-- | src/Program.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Program.cpp b/src/Program.cpp index c0e0eca..5daf25c 100644 --- a/src/Program.cpp +++ b/src/Program.cpp @@ -96,9 +96,9 @@ int exec_program_pipe(const char **args, ReadProgram *read_program) { pid_t parent_pid = getpid(); - pid_t pid = fork(); + pid_t pid = vfork(); if(pid == -1) { - perror("Failed to fork"); + perror("Failed to vfork"); close(fd[READ_END]); close(fd[WRITE_END]); return -3; @@ -238,10 +238,10 @@ int exec_program_async(const char **args, pid_t *result_process_id) { pid_t parent_pid = getpid(); - pid_t pid = fork(); + pid_t pid = vfork(); if(pid == -1) { int err = errno; - perror("Failed to fork"); + perror("Failed to vfork"); return -err; } else if(pid == 0) { /* child */ if(result_process_id) { @@ -262,7 +262,7 @@ int exec_program_async(const char **args, pid_t *result_process_id) { signal(SIGHUP, SIG_IGN); // Daemonize child to make the parent the init process which will reap the zombie child - pid_t second_child = fork(); + pid_t second_child = vfork(); if(second_child == 0) { // child execvp(args[0], (char* const*)args); perror("execvp"); |