From the man page for longjmp:
POSIX does not specify whether
longjmp()
will restore the signal
context. If you want to save and
restore signal masks, usesiglongjmp()
Your second question: Yes, the function will return -2 because longjmp()
will cause it to go to the setjmp(buffer)
part, but the timing will have to be very precise.