- Take out signal set up into a subroutine; - Use `sigaction` instead of `signal` for consistent behavior across UNIX platforms; - Enable a warning when a signal handler set up fails; - Don't do anything to SIGKILL, since it cannot be handled.