2
2
dnl Copyright (C) 2002, 2005, 2007, 2009-2012 Free Software Foundation, Inc.
3
3
dnl This file is free software; the Free Software Foundation
4
4
dnl gives unlimited permission to copy and/or distribute it,
45
45
[gl_cv_func_dup2_works=yes], [gl_cv_func_dup2_works=no],
46
46
[case "$host_os" in
47
47
mingw*) # on this platform, dup2 always returns 0 for success
48
gl_cv_func_dup2_works=no;;
48
gl_cv_func_dup2_works="guessing no" ;;
49
49
cygwin*) # on cygwin 1.5.x, dup2(1,1) returns 0
50
gl_cv_func_dup2_works=no;;
50
gl_cv_func_dup2_works="guessing no" ;;
51
51
linux*) # On linux between 2008-07-27 and 2009-05-11, dup2 of a
52
52
# closed fd may yield -EBADF instead of -1 / errno=EBADF.
53
gl_cv_func_dup2_works=no;;
53
gl_cv_func_dup2_works="guessing no" ;;
54
54
freebsd*) # on FreeBSD 6.1, dup2(1,1000000) gives EMFILE, not EBADF.
55
gl_cv_func_dup2_works=no;;
55
gl_cv_func_dup2_works="guessing no" ;;
56
56
haiku*) # on Haiku alpha 2, dup2(1, 1) resets FD_CLOEXEC.
57
gl_cv_func_dup2_works=no;;
58
*) gl_cv_func_dup2_works=yes;;
57
gl_cv_func_dup2_works="guessing no" ;;
58
*) gl_cv_func_dup2_works="guessing yes" ;;
61
if test "$gl_cv_func_dup2_works" = no; then
61
case "$gl_cv_func_dup2_works" in
65
68
dnl Replace dup2() for supporting the gnulib-defined fchdir() function,
66
69
dnl to keep fchdir's bookkeeping up-to-date.