From 2f1a88d40779d4149a9655723063c0ccc551cfcc Mon Sep 17 00:00:00 2001 From: Kevin Cernekee Date: Mon, 23 Feb 2015 09:38:14 -0800 Subject: [PATCH] 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. --- ChangeLog | 8 ++++++++ m4/dup2.m4 | 2 ++ 2 files changed, 10 insertions(+) diff --git a/ChangeLog b/ChangeLog index 3dccee643c..79ca882cad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2015-02-23 Kevin Cernekee + + 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 Android doesn't define RLIM_SAVED_* diff --git a/m4/dup2.m4 b/m4/dup2.m4 index ae87002e8a..28dbe0afb1 100644 --- a/m4/dup2.m4 +++ b/m4/dup2.m4 @@ -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]) ]) -- 2.39.5