Browse Source

The C89 standard only requires that atexit(3) returns a non-zero value

on error, so checking for -1 only is potentially non-portable.
Also mention that the C89 standard does not require errno to be set.
OK deraadt@ millert@
OPENBSD_6_6
schwarze 5 years ago
parent
commit
3f543536a9
1 changed files with 12 additions and 5 deletions
  1. +12
    -5
      src/lib/libc/stdlib/atexit.3

+ 12
- 5
src/lib/libc/stdlib/atexit.3 View File

@ -29,9 +29,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE. .\" SUCH DAMAGE.
.\" .\"
.\" $OpenBSD: atexit.3,v 1.11 2015/05/12 20:14:09 guenther Exp $
.\" $OpenBSD: atexit.3,v 1.12 2019/06/27 16:30:39 schwarze Exp $
.\" .\"
.Dd $Mdocdate: May 12 2015 $
.Dd $Mdocdate: June 27 2019 $
.Dt ATEXIT 3 .Dt ATEXIT 3
.Os .Os
.Sh NAME .Sh NAME
@ -70,7 +70,12 @@ is very difficult to use correctly without creating
races. races.
Unless absolutely necessary, please avoid using it. Unless absolutely necessary, please avoid using it.
.Sh RETURN VALUES .Sh RETURN VALUES
.Rv -std atexit
The
.Nm
function returns the value 0 if successful; otherwise a non-zero
value is returned and the global variable
.Va errno
is set to indicate the error.
.Sh ERRORS .Sh ERRORS
.Bl -tag -width Er .Bl -tag -width Er
.It Bq Er ENOMEM .It Bq Er ENOMEM
@ -86,5 +91,7 @@ The
function conforms to function conforms to
.St -ansiC . .St -ansiC .
.Pp .Pp
The behavior when a shared object is unloaded is an extension to
that standard.
Setting
.Va errno
on error and the behavior when a shared object is unloaded
are extensions to that standard.

Loading…
Cancel
Save