comparison 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
comparison
equal deleted inserted replaced
17242:45ae6ce33a1f 17243:b0688a78cfaf
1 #serial 18 1 #serial 19
2 dnl Copyright (C) 2002, 2005, 2007, 2009-2012 Free Software Foundation, Inc. 2 dnl Copyright (C) 2002, 2005, 2007, 2009-2012 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation 3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it, 4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved. 5 dnl with or without modifications, as long as this notice is preserved.
6 6
37 if (dup2 (0, 0) != -1) 37 if (dup2 (0, 0) != -1)
38 result |= 8; 38 result |= 8;
39 /* Many gnulib modules require POSIX conformance of EBADF. */ 39 /* Many gnulib modules require POSIX conformance of EBADF. */
40 if (dup2 (2, 1000000) == -1 && errno != EBADF) 40 if (dup2 (2, 1000000) == -1 && errno != EBADF)
41 result |= 16; 41 result |= 16;
42 /* Flush out a cygwin core dump. */
43 if (dup2 (2, -1) != -1 || errno != EBADF)
44 result |= 32;
42 return result; 45 return result;
43 ]) 46 ])
44 ], 47 ],
45 [gl_cv_func_dup2_works=yes], [gl_cv_func_dup2_works=no], 48 [gl_cv_func_dup2_works=yes], [gl_cv_func_dup2_works=no],
46 [case "$host_os" in 49 [case "$host_os" in