From 3f543536a973226de7ce1e999dd654b10ce2ed73 Mon Sep 17 00:00:00 2001 From: schwarze <> Date: Thu, 27 Jun 2019 16:30:39 +0000 Subject: [PATCH] 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@ --- src/lib/libc/stdlib/atexit.3 | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/lib/libc/stdlib/atexit.3 b/src/lib/libc/stdlib/atexit.3 index d428149d..a95a45b9 100644 --- a/src/lib/libc/stdlib/atexit.3 +++ b/src/lib/libc/stdlib/atexit.3 @@ -29,9 +29,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" 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 .Os .Sh NAME @@ -70,7 +70,12 @@ is very difficult to use correctly without creating races. Unless absolutely necessary, please avoid using it. .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 .Bl -tag -width Er .It Bq Er ENOMEM @@ -86,5 +91,7 @@ The function conforms to .St -ansiC . .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.