SIGINT, longjmp

Kurt Roeckx kurt at roeckx.be
Tue Jan 26 22:03:01 UTC 2016


On Tue, Jan 26, 2016 at 01:38:52PM -0800, Hal Murray wrote:
> 
> kurt at roeckx.be said:
> > It's not clear to me when this longjmp() is called.  But if changing to
> > siglongjmp() fixed it, it seems the signal handling got changed in between? 
> 
> It's called from the ^C signal handler.  It's the brute force way of 
> terminating a command.

Why do you set up a signal handler for this, and don't let the OS
take care of it?

Or alternativly, just call _exit() from the signal handler.

> I haven't found anyplace in our code that messes with the signal mask.  I 
> could easily be overlooking something that will be obvious in hindsight.

Maybe getnameinfo() does.  Like I said before, you need to be
careful of what you do in signal handlers.  Calling longjmp()
clearly isn't documented as being safe to do in that context,
for a list of functions see man signal(7).


Kurt



More information about the devel mailing list