diff m4/dup2.m4 @ 17243:b0688a78cfaf

dup2: work around cygwin bug Detected by './gnulib-tool --test dup2 cloexec'. Reported upstream: http://cygwin.com/ml/cygwin/2012-12/msg00377.html and fixed already: http://cygwin.com/ml/cygwin-cvs/2012-q4/msg00202.html but as we want to work with older cygwin, we'll have to carry this in gnulib for a while. * m4/dup2.m4 (gl_FUNC_DUP2): Flush out cygwin core dump. * lib/dup2.c (rpl_dup2): Work around it. * doc/posix-functions/dup2.texi (dup2): Document it. Signed-off-by: Eric Blake <eblake@redhat.com>
author Eric Blake <eblake@redhat.com>
date Mon, 31 Dec 2012 11:15:53 -0700
parents ca49e9a6643d
children e542fd46ad6f
line wrap: on
line diff
--- a/m4/dup2.m4
+++ b/m4/dup2.m4
@@ -1,4 +1,4 @@
-#serial 18
+#serial 19
 dnl Copyright (C) 2002, 2005, 2007, 2009-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -39,6 +39,9 @@
             /* Many gnulib modules require POSIX conformance of EBADF.  */
             if (dup2 (2, 1000000) == -1 && errno != EBADF)
               result |= 16;
+            /* Flush out a cygwin core dump.  */
+            if (dup2 (2, -1) != -1 || errno != EBADF)
+              result |= 32;
             return result;
            ])
         ],