Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The _Exit function causes normal program termination to occur and control to be
returned to the host environment. No functions registered by the atexit function or
signal handlers registered by the signal function are called. The status returned to the host environment is determined in the same way as for the exit function.
Whether open streams with unwritten buffered data are flushed, open streams are closed,
or temporary files are removed is implementation-defined. The _Exit function cannot return to its caller.

Code Block
bgColor#ccccFF
#include <stdio.h>
#include <stdlib.h>

void exit1(void) {
   if(<expr>) {
      /* ...cleanup code... */
      _Exit(0);
   }
}

int main (void) {
    atexit(exit1);
    /* ...program code... */
    exit(0);
}

...

Risk Assessment

Multiple calls to exit are unlikely, and at worst will only cause denial of service attacks or abnormal program termination.

...