mirror of https://github.com/mkerrisk/man-pages
atexit.3: Calling exit(3) more than once produces undefined results
If an exit handler itself calls exit(3), the results are undefined (see the POSIX.1-2001 specification of exit(3)). Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
db217984ec
commit
2656acee7d
|
@ -85,6 +85,23 @@ and the other process termination steps performed by
|
|||
.BR exit (3)
|
||||
are not performed.
|
||||
|
||||
POSIX.1-2001 says that the result of calling
|
||||
.BR exit (3)
|
||||
more than once (i.e., calling
|
||||
.BR exit (3)
|
||||
within a function registered using
|
||||
.BR atexit (3))
|
||||
is undefined.
|
||||
On some systems (but not Linux), this can result in an infinite recursion;
|
||||
.\" This can happen on OpenBSD 4.2 for example, and is documented
|
||||
.\" as occurring on FreeBSD as well.
|
||||
.\" Glibc does "the Right Thing" -- invocation of the remaining
|
||||
.\" exit handlers carries on as normal.
|
||||
portable programs should not invoke
|
||||
.BR exit (3)
|
||||
inside a function registered using
|
||||
.BR atexit (3).
|
||||
|
||||
The
|
||||
.BR atexit ()
|
||||
and
|
||||
|
|
Loading…
Reference in New Issue