bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] strerror_r: fix on newer cygwin


From: Eric Blake
Subject: [PATCH] strerror_r: fix on newer cygwin
Date: Thu, 19 May 2011 13:17:46 -0600

* lib/strerror_r.c (rpl_strerror_r): Cygwin now has
__xpg_strerror_r, use it.

Signed-off-by: Eric Blake <address@hidden>
---

Without this, recent test improvements were exposing failures
of gnulib's replacement on cygwin.

 ChangeLog        |    6 ++++++
 lib/strerror_r.c |   12 ++++++------
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4e22ecb..f5e455b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-05-19  Eric Blake  <address@hidden>
+
+       strerror_r: fix on newer cygwin
+       * lib/strerror_r.c (rpl_strerror_r): Cygwin now has
+       __xpg_strerror_r, use it.
+
 2011-05-19  Bruno Haible  <address@hidden>

        strerror_r: Avoid clobbering the strerror buffer when possible.
diff --git a/lib/strerror_r.c b/lib/strerror_r.c
index c4aa5d9..fe1185b 100644
--- a/lib/strerror_r.c
+++ b/lib/strerror_r.c
@@ -34,7 +34,11 @@
 # endif


-#if HAVE_DECL_STRERROR_R && !(__GLIBC__ >= 2 || defined __UCLIBC__)
+#if (__GLIBC__ >= 2 || defined __UCLIBC__ || defined __CYGWIN__) && 
HAVE___XPG_STRERROR_R /* glibc >= 2.3.4, cygwin >= 1.7.9 */
+
+# define USE_XPG_STRERROR_R 1
+
+#elif HAVE_DECL_STRERROR_R && !(__GLIBC__ >= 2 || defined __UCLIBC__)

 /* The system's strerror_r function is OK, except that its third argument
    is 'int', not 'size_t', or its return type is wrong.  */
@@ -43,10 +47,6 @@

 # define USE_SYSTEM_STRERROR_R 1

-#elif (__GLIBC__ >= 2 || defined __UCLIBC__) && HAVE___XPG_STRERROR_R /* glibc 
>= 2.3.4 */
-
-# define USE_XPG_STRERROR_R 1
-
 #else /* (__GLIBC__ >= 2 || defined __UCLIBC__ ? !HAVE___XPG_STRERROR_R : 
!HAVE_DECL_STRERROR_R) */

 /* Use the system's strerror().  */
@@ -446,7 +446,7 @@ strerror_r (int errnum, char *buf, size_t buflen)
         ret = strerror_r (errnum, buf, buflen);
     }
 # elif defined __CYGWIN__
-    /* Cygwin only provides the glibc interface, is thread-safe, and
+    /* Cygwin 1.7.8 only provides the glibc interface, is thread-safe, and
        always succeeds (although it may truncate). */
     strerror_r (errnum, buf, buflen);
     ret = 0;
-- 
1.7.4.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]