From: Tobias Stoeckmann Date: Sun, 18 May 2025 13:41:59 +0000 (+0200) Subject: man/man3/*printf.3: Document ERRORS X-Git-Tag: man-pages-6.15~51 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8bc318c60ffed8d698de2a94cb2a03ff611c3c7f;p=thirdparty%2Fman-pages.git man/man3/*printf.3: Document ERRORS The printf family of functions set errno if a negative value is returned. Source is POSIX.1, see Also see manual pages of FreeBSD and OpenBSD. Signed-off-by: Tobias Stoeckmann Message-ID: <34octlcodbwm3kfqlouvrvhriiftmlzzobbohgzivlkgi53nfs@7gxajeb56klz> Signed-off-by: Alejandro Colomar --- diff --git a/man/man3/asprintf.3 b/man/man3/asprintf.3 index 21c55bc0d..68c372ed8 100644 --- a/man/man3/asprintf.3 +++ b/man/man3/asprintf.3 @@ -37,10 +37,18 @@ to release the allocated storage when it is no longer needed. When successful, these functions return the number of bytes printed, just like .BR sprintf (3). -If memory allocation wasn't possible, or some other error occurs, -these functions will return \-1, and the contents of +On error, +\-1 is returned, +.I errno +is set to indicate the error, +and the contents of .I strp are undefined. +.SH ERRORS +See +.BR sprintf (3) +and +.BR malloc (3). .SH ATTRIBUTES For an explanation of the terms used in this section, see .BR attributes (7). diff --git a/man/man3/printf.3 b/man/man3/printf.3 index 6b33584e2..759539381 100644 --- a/man/man3/printf.3 +++ b/man/man3/printf.3 @@ -904,7 +904,30 @@ Thus, a return value of or more means that the output was truncated. (See also below under CAVEATS.) .P -If an output error is encountered, a negative value is returned. +On error, +a negative value is returned, +and +.I errno +is set to indicate the error. +.SH ERRORS +See +.BR write (2) +and +.BR putwc (3). +In addition, the following error may occur: +.TP +.B EOVERFLOW +The value to be returned is greater than +.BR INT_MAX . +.P +The +.BR dprintf () +function may fail additionally if: +.TP +.B EBADF +The +.I fd +argument is not a valid file descriptor. .SH ATTRIBUTES For an explanation of the terms used in this section, see .BR attributes (7). diff --git a/man/man3/wprintf.3 b/man/man3/wprintf.3 index 46163464a..a7324426b 100644 --- a/man/man3/wprintf.3 +++ b/man/man3/wprintf.3 @@ -198,7 +198,30 @@ case of the functions .BR swprintf () and .BR vswprintf (). -They return \-1 when an error occurs. +On error, +\-1 is returned, +and +.I errno +is set to indicate the error. +.SH ERRORS +See +.BR write (2) +and +.BR putwc (3). +In addition, the following error may occur: +.TP +.B EOVERFLOW +The value to be returned is greater than +.BR INT_MAX . +.P +The +.BR fwprintf () +and +.BR wprintf () +functions may fail additionally if: +.TP +.B ENOMEM +Insufficient storage space is available. .SH ATTRIBUTES For an explanation of the terms used in this section, see .BR attributes (7).