perror: work around FreeBSD bug
authorEric Blake <eblake@redhat.com>
Fri, 20 May 2011 17:09:53 +0000 (11:09 -0600)
committerEric Blake <eblake@redhat.com>
Fri, 20 May 2011 18:01:05 +0000 (12:01 -0600)
commit88dabde472b81a034a72484a32ef51d0fd549db8
tree8bacd95a16e20782e3974205b567e89a9a3d1560
parentc0fb797b4075b0e5f93207d4df1704aa6615cac0
perror: work around FreeBSD bug

POSIX requires that 'errno = 0; perror ("")' print the same message
as strerror(0), but this failed if we were replacing strerror to work
around the FreeBSD bug of treating 0 as a failure.

The goal here is to _not_ replace perror on glibc, even though
strerror_r has to be replaced, because the strerror_r replacement is
only for the sake of correcting the signature rather than working
around bugs in the handling of any particular errnum value.  Recall
that $gl_cv_func_strerror_r_works is only set if the POSIX signature
was detected in the first place.

* m4/perror.m4 (gl_FUNC_PERROR): Also replace perror if strerror_r
is broken.  Move AC_LIBOBJ...
* modules/perror (configure.ac): Here.
* doc/posix-functions/perror.texi (perror): Document this.
* tests/test-perror2.c (main): Enhance test.

Signed-off-by: Eric Blake <eblake@redhat.com>
ChangeLog
doc/posix-functions/perror.texi
m4/perror.m4
modules/perror
tests/test-perror2.c