Enhanced to check a return value of signal(3).