...
The
_Exit
function causes normal program termination to occur and control to be
returned to the host environment. No functions registered by theatexit
function or
signal handlers registered by thesignal
function are called. The status returned to the host environment is determined in the same way as for theexit
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 | ||
---|---|---|
| ||
#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.
...