diff options
| author | Bernhard Walle <bernhard@bwalle.de> | 2012-04-22 11:09:37 +1200 |
|---|---|---|
| committer | Michael Kerrisk <mtk.manpages@gmail.com> | 2012-04-22 11:09:37 +1200 |
| commit | a5fa6dfd1914f1546cd141a6506c86503b58770c (patch) | |
| tree | 9923bb7cdbfad7c0bfb6c25f4877d1f3513e99bf /man3/strerror.3 | |
| parent | a146d9cccd53ed73bb48e485ff430e12b3fde225 (diff) | |
| download | man-pages-a5fa6dfd1914f1546cd141a6506c86503b58770c.tar.gz | |
strerror.3: Correct description of error return for XSI strerror_r()
The XSI-compliant version of strerror_r() doesn't return -1 on
error and set errno. Instead, a positive error number is returned.
That's what POSIX says:
Upon successful completion, strerror_r() shall return 0.
Otherwise, an error number shall be returned to indicate
the error.
I tested with an invalid error number. While some implementations
seem to write "Unknown error xxx" into the supplied buffer, some
others don't and only return EINVAL. The latest glibc 2.14.1 from
Arch Linux belongs to the first category while eglibc 2.13 from
current Debian testing belongs to the second category.
However, both implementation are correct according to POSIX. So I
think the manpage was wrong and POSIX and the implementations are
correct.
Signed-off-by: Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Diffstat (limited to 'man3/strerror.3')
| -rw-r--r-- | man3/strerror.3 | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/man3/strerror.3 b/man3/strerror.3 index 37fc95d2a7..ac0c0deeaa 100644 --- a/man3/strerror.3 +++ b/man3/strerror.3 @@ -34,7 +34,7 @@ .\" 2005-12-13, mtk, Substantial rewrite of strerror_r() description .\" Addition of extra material on portability and standards. .\" -.TH STRERROR 3 2009-03-30 "" "Linux Programmer's Manual" +.TH STRERROR 3 2012-04-22 "" "Linux Programmer's Manual" .SH NAME strerror, strerror_r \- return string describing error number .SH SYNOPSIS @@ -133,9 +133,7 @@ or an "Unknown error nnn" message if the error number is unknown. The XSI-compliant .BR strerror_r () function returns 0 on success; -on error, \-1 is returned and -.I errno -is set to indicate the error. +on error, a (positive) error number is returned. .SH ERRORS .TP .B EINVAL |
