Bernhard, On Sun, Apr 22, 2012 at 12:33 AM, Bernhard Walle <bernhard@xxxxxxxxx> wrote: > 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 implementation are correct. Thanks! Applied for 3.40. Cheers, Michael > Signed-off-by: Bernhard Walle <bernhard@xxxxxxxxx> > --- > man3/strerror.3 | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/man3/strerror.3 b/man3/strerror.3 > index 37fc95d..7d6e2be 100644 > --- a/man3/strerror.3 > +++ b/man3/strerror.3 > @@ -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 > -- > 1.7.10 > -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Author of "The Linux Programming Interface"; http://man7.org/tlpi/ -- To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html