...
Nested calls to an exit function result in undefined behavior . (See also undefined behavior 182 in Annex J.) 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 SIG30-C. Call only asynchronous-safe functions within signal handlers.)
...