changeset 17931:70199a43c7c8

Replace dup2() on Android * m4/dup2.m4 (gl_FUNC_DUP2): Android implements dup2() using dup3(). Since dup3(fd, fd) fails but dup2(fd, fd) should pass, test-dup2 fails. Using rpl_dup2() fixes this because it has an explicit test for this condition.
author Kevin Cernekee <cernekee@google.com>
date Mon, 23 Feb 2015 09:38:14 -0800
parents 71aba7a74c52
children 587c85f38b58
files ChangeLog m4/dup2.m4
diffstat 2 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2015-02-23  Kevin Cernekee  <cernekee@google.com>
+
+	Replace dup2() on Android
+	* m4/dup2.m4 (gl_FUNC_DUP2): Android implements dup2() using dup3().
+	Since dup3(fd, fd) fails but dup2(fd, fd) should pass, test-dup2
+	fails.  Using rpl_dup2() fixes this because it has an explicit test
+	for this condition.
+
 2015-02-22  Paul Eggert  <eggert@cs.ucla.edu>
 
 	Android doesn't define RLIM_SAVED_*
--- a/m4/dup2.m4
+++ b/m4/dup2.m4
@@ -76,6 +76,8 @@
              gl_cv_func_dup2_works="guessing no" ;;
            haiku*) # on Haiku alpha 2, dup2(1, 1) resets FD_CLOEXEC.
              gl_cv_func_dup2_works="guessing no" ;;
+           *-android*) # implemented using dup3(), which fails if oldfd == newfd
+             gl_cv_func_dup2_works="guessing no" ;;
            *) gl_cv_func_dup2_works="guessing yes" ;;
          esac])
       ])