From: Ian Abbott Date: Thu, 8 Dec 2022 12:34:54 +0000 (+0000) Subject: scanf.3: Do not mention the ERANGE error X-Git-Tag: man-pages-6.02~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7bdbb5babeccd75a900836260e805b0ff75edafa;p=thirdparty%2Fman-pages.git scanf.3: Do not mention the ERANGE error The `scanf()` function does not intentionally set `errno` to `ERANGE`. That is just a side effect of the code that it uses to perform conversions. It also does not work as reliably as indicated in the 'man' page when the target integer type is narrower than `long`. Typically (at least in glibc) for target integer types narrower than `long`, the number has to exceed the range of `long` (for signed conversions) or `unsigned long` (for unsigned conversions) for `errno` to be set to `ERANGE`. Documenting `ERANGE` in the ERRORS section kind of implies that `scanf()` should return `EOF` when an integer overflow is encountered, which it doesn't (and doing so would violate the C standard). Just remove any mention of the `ERANGE` error to avoid confusion. Fixes: 646af540e467 ("Add an ERRORS section documenting at least some of the errors that may occur for scanf().") Link: Cc: Michael Kerrisk Cc: Zack Weinberg Signed-off-by: Ian Abbott Signed-off-by: Alejandro Colomar --- diff --git a/man3/scanf.3 b/man3/scanf.3 index 0041d55730..7638a89c0a 100644 --- a/man3/scanf.3 +++ b/man3/scanf.3 @@ -587,10 +587,6 @@ is NULL. .TP .B ENOMEM Out of memory. -.TP -.B ERANGE -The result of an integer conversion would exceed the size -that can be stored in the corresponding integer type. .SH ATTRIBUTES For an explanation of the terms used in this section, see .BR attributes (7). @@ -620,9 +616,6 @@ The functions and .BR sscanf () conform to C89 and C99 and POSIX.1-2001. -These standards do not specify the -.B ERANGE -error. .PP The .B q