You're not setting your child signal handler until after the loop has finished. Set it before the loop (just as soon as you know you're the child) and you'll see the message you're expecting.
Some additional notes:
Of course, if the poster wants to kill both parent and child, it's possible that no signal handling code is necessary at all. a ctrl-C from the shell should send a SIGINT to the process group, giving that behaviour by default.
In reply to Re: Problem with signal handler
by jbert
in thread Problem with signal handler
by LH2007
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |