From 1b19f8fb032be81398434b709192d06d17abbb87 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 23 Apr 2017 19:02:08 +0200 Subject: [PATCH] Fix conflict between strerror_r-posix module and AC_FUNC_STRERROR_R. * modules/strerror_r-posix (configure.ac): Invoke gl_MODULE_INDICATOR. * lib/error.c: Test GNULIB_STRERROR_R_POSIX before testing HAVE_DECL_STRERROR_R, HAVE_STRERROR_R, or STRERROR_R_CHAR_P. * lib/argp-help.c (__argp_failure): Likewise. --- ChangeLog | 8 ++++++++ lib/argp-help.c | 4 ++-- lib/error.c | 10 +++++----- modules/strerror_r-posix | 2 ++ 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4c91f4dd2e..4661d2575b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2017-04-23 Bruno Haible + + Fix conflict between strerror_r-posix module and AC_FUNC_STRERROR_R. + * modules/strerror_r-posix (configure.ac): Invoke gl_MODULE_INDICATOR. + * lib/error.c: Test GNULIB_STRERROR_R_POSIX before testing + HAVE_DECL_STRERROR_R, HAVE_STRERROR_R, or STRERROR_R_CHAR_P. + * lib/argp-help.c (__argp_failure): Likewise. + 2017-04-23 Bruno Haible strerror_r-posix: Revert commits from 2016-10-16,2016-11-04,2016-11-14. diff --git a/lib/argp-help.c b/lib/argp-help.c index 5567eeea44..ae639bd066 100644 --- a/lib/argp-help.c +++ b/lib/argp-help.c @@ -1873,8 +1873,8 @@ __argp_failure (const struct argp_state *state, int status, int errnum, char const *s = NULL; putc_unlocked (':', stream); putc_unlocked (' ', stream); -# if HAVE_DECL_STRERROR_R -# if STRERROR_R_CHAR_P +# if GNULIB_STRERROR_R_POSIX || HAVE_DECL_STRERROR_R +# if GNULIB_STRERROR_R_POSIX || STRERROR_R_CHAR_P s = __strerror_r (errnum, buf, sizeof buf); # else if (__strerror_r (errnum, buf, sizeof buf) == 0) diff --git a/lib/error.c b/lib/error.c index 0ed7c86bc1..feda7208d3 100644 --- a/lib/error.c +++ b/lib/error.c @@ -104,7 +104,7 @@ extern void __error_at_line (int status, int errnum, const char *file_name, /* The gnulib override of fcntl is not needed in this file. */ # undef fcntl -# if !HAVE_DECL_STRERROR_R +# if !(GNULIB_STRERROR_R_POSIX || HAVE_DECL_STRERROR_R) # ifndef HAVE_DECL_STRERROR_R "this configure-time declaration test was not run" # endif @@ -117,9 +117,9 @@ int strerror_r (int errnum, char *buf, size_t buflen); #define program_name getprogname () -# if HAVE_STRERROR_R || defined strerror_r +# if GNULIB_STRERROR_R_POSIX || HAVE_STRERROR_R || defined strerror_r # define __strerror_r strerror_r -# endif /* HAVE_STRERROR_R || defined strerror_r */ +# endif /* GNULIB_STRERROR_R_POSIX || HAVE_STRERROR_R || defined strerror_r */ #endif /* not _LIBC */ #if !_LIBC @@ -172,9 +172,9 @@ print_errno_message (int errnum) { char const *s; -#if defined HAVE_STRERROR_R || _LIBC +#if _LIBC || GNULIB_STRERROR_R_POSIX || defined HAVE_STRERROR_R char errbuf[1024]; -# if _LIBC || STRERROR_R_CHAR_P +# if _LIBC || GNULIB_STRERROR_R_POSIX || STRERROR_R_CHAR_P s = __strerror_r (errnum, errbuf, sizeof errbuf); # else if (__strerror_r (errnum, errbuf, sizeof errbuf) == 0) diff --git a/modules/strerror_r-posix b/modules/strerror_r-posix index e15cf96add..f91bc0e7cc 100644 --- a/modules/strerror_r-posix +++ b/modules/strerror_r-posix @@ -19,6 +19,8 @@ if test $HAVE_DECL_STRERROR_R = 0 || test $REPLACE_STRERROR_R = 1; then gl_PREREQ_STRERROR_R fi gl_STRING_MODULE_INDICATOR([strerror_r]) +dnl For the modules argp, error. +gl_MODULE_INDICATOR([strerror_r-posix]) Makefile.am: -- 2.39.5