title: Linux : Ignoring a signal inside a signal handler, ignoring all such successive signals
body: <p>I have a simple program to demonstrate signal handling in C for Linux. I just complicated it for experimenting..</p>
  
  <pre><code>void sigquit(int signo)
  {
      printf("Recieved signo : %d\n",signo);
      signal(SIGQUIT,SIG_IGN);
  }
  
  int main()
  {
  
      /* register the signal handler */
      if(signal(SIGQUIT,sigquit) == SIG_ERR)
      {
          perror("Error handling SIGQUIT signal");
          exit(1);
      }
      for(;;);
      return 0;
  }
  </code></pre>
  
  <p>I am getting the output : </p>
  
  <pre><code>^\Recieved signo : 3
  ^\^\^\^\^\^\^\
  </code></pre>
  
  <p>whereas I was expecting this : </p>
  
  <pre><code>    ^\Recieved signo : 3
      ^\Recieved signo : 3
      ^\Recieved signo : 3
      ^\Recieved signo : 3
  </code></pre>
  
  <p>Why only first time my handler was called and not further. I expected the signals to be first coming to the main thread and then being passed to the handlers.</p>