Use sigaction instead of signal.

The signal man page recommends sigaction:
   APPLICATION USAGE
       The  sigaction() function provides a more comprehensive and reliable
       mechanism for controlling signals; new applications should use
       sigaction() rather than signal().