The C99 exit()
function is used for normal program termination. Nested calls to exit()
result in undefined behavior. This can only occur when exit()
is invoked from a function registered with atexit()
, or when exit()
is called from within a signal handler (see SIG30-C. Call only asynchronous-safe functions within signal handlers).
No atexit()
registered handler should terminate in any way other than by returning. It is important and potentially safety-critical for all the atexit()
handlers to be allowed to perform their cleanup actions. This is particularly true because the main program doesn't does not always know about handlers that may have been installed by support libraries.
...