changeset 15778:0b7382b8128d

dup2: minor simplifications * lib/dup2.c (ms_windows_dup2): Omit 'inline' as it's not clear that it's a performance win. (rpl_dup2): Change "if !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)" to "ifdef F_GETFL".
author Paul Eggert <eggert@cs.ucla.edu>
date Sat, 24 Sep 2011 22:49:14 -0700
parents 014192d3afa0
children fb3ece2324db
files ChangeLog lib/dup2.c
diffstat 2 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2011-09-24  Paul Eggert  <eggert@cs.ucla.edu>
+
+	dup2: minor simplifications
+	* lib/dup2.c (ms_windows_dup2): Omit 'inline' as it's not clear
+	that it's a performance win.
+	(rpl_dup2): Change "if !((defined _WIN32 || defined __WIN32__) &&
+	! defined __CYGWIN__)" to "ifdef F_GETFL".
+
 2011-09-24  Jim Meyering  <meyering@redhat.com>
 
 	test-futimens: avoid a warning from gcc -Wshadow
--- a/lib/dup2.c
+++ b/lib/dup2.c
@@ -40,7 +40,7 @@
 /* Get _get_osfhandle.  */
 #  include "msvc-nothrow.h"
 
-static inline int
+static int
 ms_windows_dup2 (int fd, int desired_fd)
 {
   int result;
@@ -92,7 +92,7 @@
 {
   int result;
 
-# if !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
+# ifdef F_GETFL
   /* On Linux kernels 2.6.26-2.6.29, dup2 (fd, fd) returns -EBADF.
      On Cygwin 1.5.x, dup2 (1, 1) returns 0.
      On Haiku, dup2 (fd, fd) mistakenly clears FD_CLOEXEC.  */