From cee2cccd0249103b246678699dd608b61e63ee02 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 1 Aug 2024 13:24:10 +0200 Subject: [PATCH] strerror_r: Fix for AIX (regression yesterday). * lib/strerror_r.c: Ignore the value of STRERROR_R_CHAR_P on AIX. * m4/strerror_r.m4 (gl_FUNC_STRERROR_R): Don't define _LINUX_SOURCE_COMPAT, since it provides no advantage for strerror_r. --- ChangeLog | 7 +++++++ lib/strerror_r.c | 7 +++++-- m4/strerror_r.m4 | 9 +-------- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 78e4bd2f09..9acef580e3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2024-08-01 Bruno Haible + + strerror_r: Fix for AIX (regression yesterday). + * lib/strerror_r.c: Ignore the value of STRERROR_R_CHAR_P on AIX. + * m4/strerror_r.m4 (gl_FUNC_STRERROR_R): Don't define + _LINUX_SOURCE_COMPAT, since it provides no advantage for strerror_r. + 2024-07-31 Paul Eggert errno: make EEXIST != ENOTEMPTY on AIX diff --git a/lib/strerror_r.c b/lib/strerror_r.c index 0cd28ade6e..87fc114262 100644 --- a/lib/strerror_r.c +++ b/lib/strerror_r.c @@ -34,7 +34,7 @@ #include "strerror-override.h" -#if STRERROR_R_CHAR_P +#if STRERROR_R_CHAR_P && !defined _AIX # if HAVE___XPG_STRERROR_R _GL_EXTERN_C int __xpg_strerror_r (int errnum, char *buf, size_t buflen); @@ -159,7 +159,10 @@ strerror_r (int errnum, char *buf, size_t buflen) int ret; int saved_errno = errno; -#if STRERROR_R_CHAR_P + /* Due to the '#undef strerror_r' above, on AIX, we're always using + the POSIX-compatible strerror_r function, regardless whether + _LINUX_SOURCE_COMPAT is defined or not. */ +#if STRERROR_R_CHAR_P && !defined _AIX { ret = 0; diff --git a/m4/strerror_r.m4 b/m4/strerror_r.m4 index eae9f1c419..5353972172 100644 --- a/m4/strerror_r.m4 +++ b/m4/strerror_r.m4 @@ -1,5 +1,5 @@ # strerror_r.m4 -# serial 27 +# serial 28 dnl Copyright (C) 2002, 2007-2024 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -10,13 +10,6 @@ AC_DEFUN([gl_FUNC_STRERROR_R], AC_REQUIRE([gl_STRING_H_DEFAULTS]) AC_REQUIRE([gl_FUNC_STRERROR_R_WORKS]) - dnl On AIX, ask for the GNU/Linux API. Other modules might ask for - dnl that API for other reasons, so we will will need override it because - dnl we cannot easily ask AIX for the GNU/Linux API for everything - dnl but strerror_r. - AC_DEFINE([_LINUX_SOURCE_COMPAT], [1], - [Define so that AIX headers are more compatible with GNU/Linux.]) - dnl Some systems don't declare strerror_r() if _THREAD_SAFE and _REENTRANT dnl are not defined. AC_CHECK_DECLS_ONCE([strerror_r]) -- 2.39.5