]> Savannah Git Hosting - gnulib.git/commitdiff
dup2: doc and test for Android bug
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 23 Feb 2015 18:34:40 +0000 (10:34 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 23 Feb 2015 18:37:06 +0000 (10:37 -0800)
Reported by Kevin Cernekee in:
http://lists.gnu.org/archive/html/bug-gnulib/2015-02/msg00125.html
* doc/posix-functions/dup2.texi (dup2): Document the bug.
* m4/dup2.m4 (gl_FUNC_DUP2): Test for the bug.

ChangeLog
doc/posix-functions/dup2.texi
m4/dup2.m4

index 79ca882caddc51cfb8246ec82f69f85f169cc3b3..c29b05c8538c880eef108aeb3c7d844b34cc1bb0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2015-02-23  Paul Eggert  <eggert@cs.ucla.edu>
+
+       dup2: doc and test for Android bug
+       Reported by Kevin Cernekee in:
+       http://lists.gnu.org/archive/html/bug-gnulib/2015-02/msg00125.html
+       * doc/posix-functions/dup2.texi (dup2): Document the bug.
+       * m4/dup2.m4 (gl_FUNC_DUP2): Test for the bug.
+
 2015-02-23  Kevin Cernekee  <cernekee@google.com>
 
        Replace dup2() on Android
index 6e501b5878c9a98a4426a770a3b19ad79a5515ff..d04ad07cdd0782c4630877084758ed360b327f9d 100644 (file)
@@ -24,6 +24,10 @@ Cygwin 1.7.17, MSVC 9.
 This function crashes when invoked with valid arguments on some platforms:
 Cygwin 1.7.25.
 
+@item
+This function fails with @code{EINVAL} when duplicating an fd to itself:
+Android.
+
 @item
 This function resets the @code{FD_CLOEXEC} flag when duplicating an fd
 to itself on some platforms:
index 28dbe0afb151da3208d59e635567febda26b5dfa..59028e0982cc2990cabf2e71d565906b4337d7f4 100644 (file)
@@ -1,4 +1,4 @@
-#serial 23
+#serial 24
 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,
@@ -45,7 +45,7 @@ AC_DEFUN([gl_FUNC_DUP2],
                if (fcntl (1, F_SETFD, FD_CLOEXEC) == -1)
                  result |= 1;
              #endif
-             if (dup2 (1, 1) == 0)
+             if (dup2 (1, 1) != 1)
                result |= 2;
              #ifdef FD_CLOEXEC
                if (fcntl (1, F_GETFD) != FD_CLOEXEC)