longjmp + signal may cause problems

Steve Glaser steveg at hammer.UUCP
Wed Dec 7 13:16:49 AEST 1983


Actually, a somewhat more serious race condition in the first example
(where the signal handler did a longjmp to exit things) is that you
could get the signal before the setjmp ever finished executing and thus
end up doing a longjmp to somewhere random.

If you make the assumptions that there's a human on the other end of
things and that computers are relatively fast, it's not very likely to
cause a problem, but relatively easy to fix - just make sure you don't
enable the signal catcher until after the setjmp.

	Steve Glaser
	[tektronix|teklabs]!steveg	UUCP
	steveg.tektronix at rand-relay	ARPANET/CSNET



More information about the Comp.unix.wizards mailing list