title: Custom SIGINT signal handler - Program still terminates even after signal is caught
body: <p>I am playing with the <code>signal.h</code> and <code>unistd.h</code> libraries, and I am having some issues. In the code below, when I send the <code>SIGINT</code> signal to my running program by calling <code>CTRL-C</code>, the signal is caught. However, when pressing <code>CTRL-C</code> again, the program terminates. As I understand it, the print statement <code>"Received signal 2"</code> should be printed every time I press <code>CTRL-C</code>.</p>
  
  <p>Is my understanding of this signal incorrect, or is there a bug in my code?</p>
  
  <p>Thanks for your input!</p>
  
  <pre><code>#include "handle_signals.h"
  
  
  void sig_handler(int signum)
  {
      printf("\nReceived signal %d\n", signum);
  }
  
  int main()
  {
      signal(SIGINT, sig_handler);
      while(1)
      {
          sleep(1);
      }
      return 0;
  }
  </code></pre>
  
  <p>Terminal output:</p>
  
  <pre><code>xxx@ubuntu:~/Dropbox/xxx/handle_signals$ ./handle_signals 
  ^C
  Received signal 2
  ^C
  xxx@ubuntu:~/Dropbox/xxx/handle_signals$ 
  </code></pre>
  
  <p>Edit: Here is the header I've included</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;signal.h&gt;
  #include &lt;unistd.h&gt;
  
  
  void sig_handler(int signum);
  </code></pre>
  
  <p>Thanks for your responses. Reading through them now!</p>