changeset 17922:1092f168a05e

dup2, fcntl: cross-compiler better for Android Problem reported by Kevin Cernekee in: http://lists.gnu.org/archive/html/bug-gnulib/2015-02/msg00109.html * m4/dup2.m4 (gl_FUNC_DUP2): Don't guess no when cross-compiling for a Linux kernel. That kernel bug was fixed on 2009-05-11, and there's little need to cross-compile for older kernels nowadays. * m4/fcntl.m4 (gl_FUNC_FCNTL): When cross-compiling, guess no only for systems where the bug is known to occur (AIX, Cygwin, Haiku).
author Paul Eggert <eggert@cs.ucla.edu>
date Wed, 18 Feb 2015 23:20:55 -0800
parents 58c1b50299a6
children 2b5c3699ac6f
files ChangeLog m4/dup2.m4 m4/fcntl.m4
diffstat 3 files changed, 17 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2015-02-18  Paul Eggert  <eggert@cs.ucla.edu>
+
+	dup2, fcntl: cross-compiler better for Android
+	Problem reported by Kevin Cernekee in:
+	http://lists.gnu.org/archive/html/bug-gnulib/2015-02/msg00109.html
+	* m4/dup2.m4 (gl_FUNC_DUP2): Don't guess no when cross-compiling
+	for a Linux kernel.  That kernel bug was fixed on 2009-05-11, and
+	there's little need to cross-compile for older kernels nowadays.
+	* m4/fcntl.m4 (gl_FUNC_FCNTL): When cross-compiling, guess no only
+	for systems where the bug is known to occur (AIX, Cygwin, Haiku).
+
 2015-02-18  Pádraig Brady  <P@draigBrady.com>
 
 	getopt: don't crash on memory exhaustion
--- a/m4/dup2.m4
+++ b/m4/dup2.m4
@@ -1,4 +1,4 @@
-#serial 21
+#serial 22
 dnl Copyright (C) 2002, 2005, 2007, 2009-2015 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -64,9 +64,6 @@
              gl_cv_func_dup2_works="guessing no" ;;
            cygwin*) # on cygwin 1.5.x, dup2(1,1) returns 0
              gl_cv_func_dup2_works="guessing no" ;;
-           linux*) # On linux between 2008-07-27 and 2009-05-11, dup2 of a
-                   # closed fd may yield -EBADF instead of -1 / errno=EBADF.
-             gl_cv_func_dup2_works="guessing no" ;;
            aix* | freebsd*)
                    # on AIX 7.1 and FreeBSD 6.1, dup2 (1,toobig) gives EMFILE,
                    # not EBADF.
--- a/m4/fcntl.m4
+++ b/m4/fcntl.m4
@@ -1,4 +1,4 @@
-# fcntl.m4 serial 6
+# fcntl.m4 serial 7
 dnl Copyright (C) 2009-2015 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -51,10 +51,10 @@
               return result;]])],
          [gl_cv_func_fcntl_f_dupfd_works=yes],
          [gl_cv_func_fcntl_f_dupfd_works=no],
-         [# Guess that it works on glibc systems
-          case $host_os in #((
-            *-gnu*) gl_cv_func_fcntl_f_dupfd_works="guessing yes";;
-            *)      gl_cv_func_fcntl_f_dupfd_works="guessing no";;
+         [case $host_os in
+            aix* | cygwin* | haiku*)
+               gl_cv_func_dup2_works="guessing no" ;;
+            *) gl_cv_func_dup2_works="guessing yes" ;;
           esac])])
     case $gl_cv_func_fcntl_f_dupfd_works in
       *yes) ;;