title: waitpid(pid,status,0) status not reading correctly
body: <p>everyone. I've got a problem that is making me very confused. I'm just trying to print out the status received from a terminated process but it isn't working the way I thought it would. Here is the code.</p>
  
  <pre><code>int main(int argc, char *argv[])
  {
    printf("this process (%d)\n",(int)(getpid()));
    int *status;
    pid_t pid;
    Signal(SIGINT, handler1);
  
    if ((pid = fork())==0){
      while(1)
        ;
    }
    kill(pid,SIGINT);
    while(pid&gt;0){
      pid = waitpid(pid,status,0);
      printf("status: %d\n", WEXITSTATUS(status));
      printf("waitpid return: %d\n",(int)pid);
    }
    return 0;
  } 
  
  void handler1(int sig){
    printf("process (%d) has received a sigint\n",(int)(getpid()));
    exit('d');
  }
  </code></pre>
  
  <p>it has output</p>
  
  <pre><code>this process (8811)
  process (8812) has received a sigint
  status: 0
  waitpid return: 8812
  status: 0
  waitpid return: -1
  </code></pre>
  
  <p>when I use WIFEXITED(status) it returns true. So shouldn't WEXITSTATUS return what I passed through exit and not 0?</p>
  
  <p>I did not include the Signal function here.</p>