From 936cef69b1e34a2f654de30577cce8bf6db461b5 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 24 Sep 2011 22:49:14 -0700 Subject: [PATCH] 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". --- ChangeLog | 8 ++++++++ lib/dup2.c | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index f154617a4..c29708733 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2011-09-24 Paul Eggert + + 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 test-futimens: avoid a warning from gcc -Wshadow diff --git a/lib/dup2.c b/lib/dup2.c index 278261fcd..790c98a2e 100644 --- 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 @@ rpl_dup2 (int fd, int desired_fd) { 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. */ -- 2.11.0