summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Abbott <abbotti@mev.co.uk>2022-12-08 12:34:54 +0000
committerAlejandro Colomar <alx@kernel.org>2022-12-12 12:30:19 +0100
commit7bdbb5babeccd75a900836260e805b0ff75edafa (patch)
tree29791de8668fbac4ad66d1c4ef568639c1db628d
parenta15d34326c581eab107bf05782cc60d8ebdcad69 (diff)
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: <https://lore.kernel.org/linux-man/5af4f708-337f-fddf-9a2d-e0e4602d3a72@mev.co.uk/T/#m900a1b1741afefab008a69e6b76919cd94aa81ef> Cc: Michael Kerrisk <mtk.manpages@gmail.com> Cc: Zack Weinberg <zack@owlfolio.org> Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Alejandro Colomar <alx@kernel.org>
-rw-r--r--man3/scanf.37
1 files changed, 0 insertions, 7 deletions
diff --git a/man3/scanf.3 b/man3/scanf.3
index 0041d5573..7638a89c0 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