in reply to signals after exec

exec is a wrapper around the corresponding system call (actually, a whole family of functions). Their man pages, e.g. execve(2) and signal(7) say that "the dispositions of handled signals are reset to the default; the dispositions of ignored signals are left unchanged."

Replies are listed 'Best First'.
Re^2: signals after exec
by afoken (Chancellor) on Aug 26, 2017 at 09:00 UTC
    "the dispositions of handled signals are reset to the default; the dispositions of ignored signals are left unchanged."

    ... and if you think about it, it makes sense. Ignoring a signal just sets a flag somewhere in the process structure managed by the kernel. The same is true for the other default actions terminate, terminate and dump core, stop and continue. Custom signal handlers, i.e. every signal handler somewhere in the code of the process, are overwritten by exec() (Remember: exec() replaces the executable in the current process with a different one), and so the signal handler pointers would point to some nonsense. If exec() would not reset the signal handlers, invoking the first custom signal handler would crash the executable (by executing unrelated code).

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)