diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2019-06-28 14:36:19 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2019-06-28 14:36:19 +0000 |
commit | 34cd318ca40612c51aa27691f16be20c57ae4a5d (patch) | |
tree | 73e13b22addafe20fd858f9223074f97ee9f08d9 /lib | |
parent | 0579dc34ca62d17a6fc1bd4662b0390a6d097c1e (diff) |
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')
-rw-r--r-- | lib/libc/stdio/printf.3 | 18 |
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 |