summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2019-06-28 14:36:18 +0000
committerschwarze <schwarze@openbsd.org>2019-06-28 14:36:18 +0000
commite5a82e7805e650ab7ae606b1b37e39c82731b4c1 (patch)
tree9b5f03889e72126d6a3b1fe01357ddcc5f53fc09 /lib/libc/stdio
parentActually, the C standard only guarantees that atexit(3) returns non-zero (diff)
downloadwireguard-openbsd-e5a82e7805e650ab7ae606b1b37e39c82731b4c1.tar.xz
wireguard-openbsd-e5a82e7805e650ab7ae606b1b37e39c82731b4c1.zip
Specify that {v,}asprintf(3) returns precisely -1 on failure,
and that the ret pointer is either unchanged or set to NULL in this case. Since these two functions are not standardized by POSIX, documenting the actual behaviour is the way to go, and the above matches all non-buggy implementations we are aware of. OK millert@ deraadt@
Diffstat (limited to 'lib/libc/stdio')
-rw-r--r--lib/libc/stdio/printf.318
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/libc/stdio/printf.3 b/lib/libc/stdio/printf.3
index 88dddcba4d3..e45c39c62a3 100644
--- a/lib/libc/stdio/printf.3
+++ b/lib/libc/stdio/printf.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: printf.3,v 1.82 2019/06/27 11:52:59 schwarze Exp $
+.\" $OpenBSD: printf.3,v 1.83 2019/06/28 14:36:18 schwarze Exp $
.\"
.\" Copyright (c) 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -33,7 +33,7 @@
.\"
.\" @(#)printf.3 8.1 (Berkeley) 6/4/93
.\"
-.Dd $Mdocdate: June 27 2019 $
+.Dd $Mdocdate: June 28 2019 $
.Dt PRINTF 3
.Os
.Sh NAME
@@ -689,15 +689,19 @@ it should be passed to
.Xr free 3
to release the allocated storage
when it is no longer needed.
-If sufficient space cannot be allocated, these functions
-will return \-1.
+If sufficient space cannot be allocated or some other error occurs,
+these functions return \-1.
The value of
.Fa ret
-in this situation is implementation-dependent
-(on
+in this situation is implementation-dependent.
+On
.Ox ,
.Fa ret
-will be set to the null pointer, but this behavior should not be relied upon).
+is set to the
+.Dv NULL
+pointer, but other implementations may leave
+.Fa ret
+unchanged.
.Sh EXAMPLES
To print a date and time in the form `Sunday, July 3, 10:02',
where