Replace dup2() on Android
authorKevin Cernekee <cernekee@google.com>
Mon, 23 Feb 2015 17:38:14 +0000 (09:38 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 23 Feb 2015 18:37:06 +0000 (10:37 -0800)
* 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.

ChangeLog
m4/dup2.m4

index 3dccee643cbe49bb9a9cb16291cf9e71de4b3363..79ca882caddc51cfb8246ec82f69f85f169cc3b3 100644 (file)
--- 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_*
index ae87002e8ae134376e5cb18d46a2ed2ab9f99e03..28dbe0afb151da3208d59e635567febda26b5dfa 100644 (file)
@@ -76,6 +76,8 @@ AC_DEFUN([gl_FUNC_DUP2],
              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])
       ])