title: Unsure how to find out whether the Child process is terminated via completion or a signal
body: <p><p>I'm trying to write a program where,<ul><li> My parent process should be able to ignore the SIGINT signal and </li><li>My child process, on the other hand, should perform the default function of the SIGINT signal.</li><li>And finally, I should find out whether the Child process was terminated by any particular signal.</li><li>My child process basically executes an execvp(), based on some input.</li></ul><p>Hence, the way I went about trying to do the same is, I added a SIGINT handler for my parent process and my guess is when the execvp() function is invoked, the child process would perform the SIGINT process using the default handlers. </p></p>
  
  <pre><code> void sigint_handler(int signum){
      printf("");
   }
  
  int main(int argc, char **argv){
  
  pid_t pid = fork();
  
  if(pid&lt;0)
  {
  printf("fork: error");
  exit(-1);
  
  }
  else if(pid&gt;0){
      int status;
      signal(SIGINT,sigint_handler);
      pid_t child_pid= waitpid(pid, &amp;status, 0);
      printf("");
  }
  else if(pid==0){
      printf("");
      if(execvp(argv[1],&amp;argv[1]) == -1) {
      printf(" ");
      exit(-1);
        }
  
  }
  
  }
  </code></pre>
  
  <p><p>Is this code sufficient to handle the same? Also, if my child process is terminated by SIGINT or SIGSEGV etc, how would I go about finding whether my child process was terminated after completion or because of a signal and what signal was used.</p>