diff options
Diffstat (limited to 'src/Program.cpp')
-rw-r--r-- | src/Program.cpp | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/src/Program.cpp b/src/Program.cpp index 5daf25c..513ce8c 100644 --- a/src/Program.cpp +++ b/src/Program.cpp @@ -1,7 +1,6 @@ #include "../include/Program.hpp" #include <unistd.h> #include <sys/wait.h> -#include <sys/prctl.h> #include <errno.h> #include <string.h> #include <stdio.h> @@ -94,8 +93,6 @@ int exec_program_pipe(const char **args, ReadProgram *read_program) { return -2; } - pid_t parent_pid = getpid(); - pid_t pid = vfork(); if(pid == -1) { perror("Failed to vfork"); @@ -103,15 +100,6 @@ int exec_program_pipe(const char **args, ReadProgram *read_program) { close(fd[WRITE_END]); return -3; } else if(pid == 0) { /* child */ - if(prctl(PR_SET_PDEATHSIG, SIGTERM) == -1) { - perror("prctl(PR_SET_PDEATHSIG, SIGTERM) failed"); - _exit(127); - } - - /* Test if the parent died before the above call to prctl */ - if(getppid() != parent_pid) - _exit(127); - dup2(fd[WRITE_END], STDOUT_FILENO); close(fd[READ_END]); close(fd[WRITE_END]); @@ -236,8 +224,6 @@ int exec_program_async(const char **args, pid_t *result_process_id) { if(args[0] == NULL) return -1; - pid_t parent_pid = getpid(); - pid_t pid = vfork(); if(pid == -1) { int err = errno; @@ -245,15 +231,6 @@ int exec_program_async(const char **args, pid_t *result_process_id) { return -err; } else if(pid == 0) { /* child */ if(result_process_id) { - if(prctl(PR_SET_PDEATHSIG, SIGTERM) == -1) { - perror("prctl(PR_SET_PDEATHSIG, SIGTERM) failed"); - _exit(127); - } - - /* Test if the parent died before the above call to prctl */ - if(getppid() != parent_pid) - _exit(127); - execvp(args[0], (char* const*)args); perror("execvp"); _exit(127); |