]> Savannah Git Hosting - gnulib.git/commitdiff
strerror_r: Fix for AIX (regression yesterday).
authorBruno Haible <bruno@clisp.org>
Thu, 1 Aug 2024 11:24:10 +0000 (13:24 +0200)
committerBruno Haible <bruno@clisp.org>
Thu, 1 Aug 2024 11:24:10 +0000 (13:24 +0200)
* 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
lib/strerror_r.c
m4/strerror_r.m4

index 78e4bd2f0913d77cd1cf904f0ed8af8912fcf491..9acef580e3ff400e5a5b311eb32d506c3d384b74 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2024-08-01  Bruno Haible  <bruno@clisp.org>
+
+       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  <eggert@cs.ucla.edu>
 
        errno: make EEXIST != ENOTEMPTY on AIX
index 0cd28ade6e60e741f92636478698f05a8d0ad866..87fc1142629161b5463fa33b538d8d5de6dd4e81 100644 (file)
@@ -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;
index eae9f1c4193bd4135ffdfc1309beba8a0a237c9d..53539721722e0c29a3d7c26ab3735ad818ab47f3 100644 (file)
@@ -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])