bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH] strerror_r: avoid clobbering strerror on cygwin


From: Bruno Haible
Subject: Re: [PATCH] strerror_r: avoid clobbering strerror on cygwin
Date: Sat, 21 May 2011 20:27:11 +0200
User-agent: KMail/1.9.9

Eric Blake wrote:
> Avoid cygwin strerror_r, since it clobbers strerror buffer through
> cygwin 1.7.9.  __xpg_strerror_r is okay, but if a program is
> compiled on cygwin 1.7.8 or earlier, it is not available.
> 
> * lib/strerror_r.c (strerror_r): Don't use cygwin's strerror_r;
> fall back instead to sys_errlist.

Good point.

> -/* Get sys_nerr, sys_errlist on native Windows.  */
> +/* Get sys_nerr, sys_errlist on native Windows and Cygwin.  */
>  #  include <stdlib.h>

sys_nerr and sys_errlist are already declared in <errno.h>, on Cygwin 1.5.x
and 1.7.x, like on many other platforms. It this comment change OK with you?


--- lib/strerror_r.c.orig       Sat May 21 20:23:42 2011
+++ lib/strerror_r.c    Sat May 21 20:23:34 2011
@@ -77,7 +77,7 @@
 extern int sys_nerr;
 #  endif
 
-/* Get sys_nerr, sys_errlist on native Windows and Cygwin.  */
+/* Get sys_nerr, sys_errlist on native Windows.  */
 #  include <stdlib.h>
 
 # else
@@ -504,7 +504,7 @@
                       and <errno.h> above.
        HP-UX:         sys_nerr, sys_errlist are declared explicitly above.
        native Win32:  sys_nerr, sys_errlist are declared in <stdlib.h>.
-       Cygwin:        sys_nerr, sys_errlist are declared in <stdlib.h>.  */
+       Cygwin:        sys_nerr, sys_errlist are declared in <errno.h>.  */
     if (errnum >= 0 && errnum < sys_nerr)
       {
 #  if HAVE_CATGETS && (defined __NetBSD__ || defined __hpux)

-- 
In memoriam Alfred Grünberg <http://en.wikipedia.org/wiki/Alfred_Grünberg>



reply via email to

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