comparison doc/posix-functions/strerror.texi @ 14762:3c012e3d3f43

strerror: enforce POSIX ruling on strerror(0) http://austingroupbugs.net/view.php?id=382 requires that strerror(0) succeed, but FreeBSD reports "Unknown error: 0" and fails with EINVAL. * m4/strerror.m4 (gl_FUNC_STRERROR_SEPARATE): Expose BSD bug. * m4/strerror_r.m4 (gl_FUNC_STRERROR_R): Likewise. * lib/strerror_r.c (rpl_strerror_r): Work around it. * doc/posix-functions/strerror.texi (strerror): Document it. * doc/posix-functions/strerror_r.texi (strerror_r): Likewise. * tests/test-strerror.c (main): Strengthen test. * tests/test-strerror_r.c (main): Likewise. Signed-off-by: Eric Blake <eblake@redhat.com>
author Eric Blake <eblake@redhat.com>
date Wed, 18 May 2011 18:16:59 -0600
parents d75056826e59
children 66b65ce5da39
comparison
equal deleted inserted replaced
14761:6c5502aeb486 14762:3c012e3d3f43
11 @item 11 @item
12 This function does not support the error values that are specified by POSIX 12 This function does not support the error values that are specified by POSIX
13 but not defined by the system, on some platforms: 13 but not defined by the system, on some platforms:
14 OpenBSD 4.0, OSF/1 5.1, NonStop Kernel, Cygwin 1.5.x, mingw. 14 OpenBSD 4.0, OSF/1 5.1, NonStop Kernel, Cygwin 1.5.x, mingw.
15 @item 15 @item
16 This function reports failure (by setting @code{errno}) for
17 @code{strerror(0)}, although POSIX requires this to leave @code{errno}
18 unchanged and report success, on some platforms:
19 FreeBSD 8.2
20 @item
16 This function fails to return a string for out-of-range integers on 21 This function fails to return a string for out-of-range integers on
17 some platforms: 22 some platforms:
18 HP-UX 11, IRIX 6.5, Solaris 8. 23 HP-UX 11, IRIX 6.5, Solaris 8.
19 (This is not a POSIX violation, but can still cause bugs because most programs 24 (Some return NULL which is a POSIX violation, others return the empty
20 call @code{strerror} without setting and testing @code{errno}.) 25 string which is valid but not as useful); this can still cause bugs
26 because most programs call @code{strerror} without setting and testing
27 @code{errno}.)
21 @end itemize 28 @end itemize
22 29
23 Portability problems not fixed by Gnulib: 30 Portability problems not fixed by Gnulib:
24 @itemize 31 @itemize
25 @end itemize 32 @end itemize