> 2011-05-18 Bruno Haible <br...@clisp.org> > > strerror_r: Avoid clobbering the strerror buffer when possible. > * lib/strerror_r.c (strerror_r): Merge the three implementations. > Handle gnulib defined errno values here. When strerror() returns NULL > or an empty string, return EINVAL. > * lib/strerror.c (strerror): Always call strerror_r. Don't handle > gnulib defined errno values here. > * modules/strerror (Depends-on): Add verify, strerror_r-posix.
Oops, this led to a test failure on mingw. EXTEND_STRERROR_R was not defined on mingw, because the function strerror_r does not exist there in the first place. This should be more reliable: 2011-05-19 Bruno Haible <br...@clisp.org> strerror_r: Fix test failure on mingw. * m4/strerror_r.m4 (gl_FUNC_STRERROR_R): Don't define EXTEND_STRERROR_R. * lib/strerror_r.c (strerror_r): Test the various GNULIB_defined_* macros from errno.in.h instead. --- m4/strerror_r.m4.orig Thu May 19 20:39:58 2011 +++ m4/strerror_r.m4 Thu May 19 20:39:16 2011 @@ -1,4 +1,4 @@ -# strerror_r.m4 serial 4 +# strerror_r.m4 serial 5 dnl Copyright (C) 2002, 2007-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -93,9 +93,6 @@ dnl The system's strerror_r() cannot know about the new errno values we dnl add to <errno.h>. Replace it. REPLACE_STRERROR_R=1 - AC_DEFINE([EXTEND_STRERROR_R], [1], - [Define to 1 if strerror_r needs to be extended so that it handles the - extra errno values.]) fi fi if test $HAVE_DECL_STRERROR_R = 0 || test $REPLACE_STRERROR_R = 1; then --- lib/strerror_r.c.orig Thu May 19 20:39:58 2011 +++ lib/strerror_r.c Thu May 19 20:38:31 2011 @@ -64,7 +64,19 @@ strerror_r (int errnum, char *buf, size_t buflen) #undef strerror_r { -#if EXTEND_STRERROR_R +#if GNULIB_defined_ETXTBSY \ + || GNULIB_defined_ESOCK \ + || GNULIB_defined_ENOMSG \ + || GNULIB_defined_EIDRM \ + || GNULIB_defined_ENOLINK \ + || GNULIB_defined_EPROTO \ + || GNULIB_defined_EMULTIHOP \ + || GNULIB_defined_EBADMSG \ + || GNULIB_defined_EOVERFLOW \ + || GNULIB_defined_ENOTSUP \ + || GNULIB_defined_ESTALE \ + || GNULIB_defined_EDQUOT \ + || GNULIB_defined_ECANCELED { char const *msg = NULL; /* These error messages are taken from glibc/sysdeps/gnu/errlist.c. */ -- In memoriam Anne Boleyn <http://en.wikipedia.org/wiki/Anne_Boleyn>