annotate doc/posix-functions/strerror.texi @ 14895:66b65ce5da39

strerror_r-posix: fix on MacOS MacOS X 10.5 strerror(0) is "Unknown error: 0", which is not distinguished from "Unknown error: -1" for out-of-range. Worse, strerror_r(0,,) is "Undefined error: 0", although strerror_r for all other out-of-range values matches strerror. * m4/strerror.m4 (gl_FUNC_STRERROR): Flush out MacOS bug. * m4/strerror_r.m4 (gl_FUNC_STRERROR_R_WORKS): Likewise, and fix logic bug. * lib/strerror_r.c (strerror_r): Fix the bug. * lib/strerror.c (strerror): Likewise. * doc/posix-functions/strerror_r.texi (strerror_r): Document the problem. * doc/posix-functions/strerror.texi (strerror): Likewise. * doc/posix-functions/perror.texi (perror): Likewise. * tests/test-strerror.c (main): Enhance test. * tests/test-strerror_r.c (main): Likewise. Signed-off-by: Eric Blake <eblake@redhat.com>
author Eric Blake <eblake@redhat.com>
date Tue, 07 Jun 2011 20:49:04 -0600
parents 3c012e3d3f43
children a3ba680ad389
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9638
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 @node strerror
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2 @section @code{strerror}
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3 @findex strerror
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4
13549
bb0ceefd22dc avoid some overlong lines from posix urls, etc.
Karl Berry <karl@freefriends.org>
parents: 13148
diff changeset
5 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/strerror.html}
9638
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 Gnulib module: strerror
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9 Portability problems fixed by Gnulib:
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 @itemize
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 @item
10429
69d9922a5bd2 Extend strerror to cover the added errno values.
Bruno Haible <bruno@clisp.org>
parents: 9638
diff changeset
12 This function does not support the error values that are specified by POSIX
69d9922a5bd2 Extend strerror to cover the added errno values.
Bruno Haible <bruno@clisp.org>
parents: 9638
diff changeset
13 but not defined by the system, on some platforms:
13754
3805b556be4b Define missing EDQUOT on NonStop Kernel.
Bruno Haible <bruno@clisp.org>
parents: 13549
diff changeset
14 OpenBSD 4.0, OSF/1 5.1, NonStop Kernel, Cygwin 1.5.x, mingw.
9638
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
15 @item
14895
66b65ce5da39 strerror_r-posix: fix on MacOS
Eric Blake <eblake@redhat.com>
parents: 14762
diff changeset
16 This function reports failure for @code{strerror(0)} (by setting
66b65ce5da39 strerror_r-posix: fix on MacOS
Eric Blake <eblake@redhat.com>
parents: 14762
diff changeset
17 @code{errno} or using a string similar to out-of-range values),
66b65ce5da39 strerror_r-posix: fix on MacOS
Eric Blake <eblake@redhat.com>
parents: 14762
diff changeset
18 although POSIX requires this to leave @code{errno} unchanged and
66b65ce5da39 strerror_r-posix: fix on MacOS
Eric Blake <eblake@redhat.com>
parents: 14762
diff changeset
19 report success, on some platforms:
66b65ce5da39 strerror_r-posix: fix on MacOS
Eric Blake <eblake@redhat.com>
parents: 14762
diff changeset
20 FreeBSD 8.2, MacOS X 10.5.
14762
3c012e3d3f43 strerror: enforce POSIX ruling on strerror(0)
Eric Blake <eblake@redhat.com>
parents: 13844
diff changeset
21 @item
9638
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
22 This function fails to return a string for out-of-range integers on
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
23 some platforms:
13844
d75056826e59 doc: List more failing platforms.
Bruno Haible <bruno@clisp.org>
parents: 13843
diff changeset
24 HP-UX 11, IRIX 6.5, Solaris 8.
14762
3c012e3d3f43 strerror: enforce POSIX ruling on strerror(0)
Eric Blake <eblake@redhat.com>
parents: 13844
diff changeset
25 (Some return NULL which is a POSIX violation, others return the empty
3c012e3d3f43 strerror: enforce POSIX ruling on strerror(0)
Eric Blake <eblake@redhat.com>
parents: 13844
diff changeset
26 string which is valid but not as useful); this can still cause bugs
3c012e3d3f43 strerror: enforce POSIX ruling on strerror(0)
Eric Blake <eblake@redhat.com>
parents: 13844
diff changeset
27 because most programs call @code{strerror} without setting and testing
3c012e3d3f43 strerror: enforce POSIX ruling on strerror(0)
Eric Blake <eblake@redhat.com>
parents: 13844
diff changeset
28 @code{errno}.)
9638
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
29 @end itemize
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
30
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
31 Portability problems not fixed by Gnulib:
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
32 @itemize
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
33 @end itemize