...
A nested call to an exit function is undefined behavior. (see See undefined behavior 182.) . This behavior can occur only when an exit function is invoked from an exit handler or when an exit function is called from within a signal handler. (see See SIG30-C. Call only asynchronous-safe functions within signal handlers.).
If a call to the longjmp()
function is made that would terminate the call to a function registered with atexit()
, the behavior is undefined.
...