From: Eric Blake Date: Mon, 24 Aug 2009 22:00:44 +0000 (-0600) Subject: dup2, pipe2: fix some recent test failures on cygwin 1.5.x X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0d9fce2a47c3ff91991d9f93259ccf5877af2ccc;p=pspp dup2, pipe2: fix some recent test failures on cygwin 1.5.x * lib/pipe2.c (includes): Add binary-io.h. * lib/dup2.c (rpl_dup2): Correct buggy errno value. Signed-off-by: Eric Blake --- diff --git a/ChangeLog b/ChangeLog index 501fba7f9f..986e12c9b2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-08-24 Eric Blake + + dup2, pipe2: fix some recent test failures on cygwin 1.5.x + * lib/pipe2.c (includes): Add binary-io.h. + * lib/dup2.c (rpl_dup2): Correct buggy errno value. + 2009-08-24 Bruno Haible Tolerate declared but missing accept4 syscall. diff --git a/lib/dup2.c b/lib/dup2.c index 6d61829343..6b6f45db4d 100644 --- a/lib/dup2.c +++ b/lib/dup2.c @@ -57,6 +57,9 @@ rpl_dup2 (int fd, int desired_fd) result = dup2 (fd, desired_fd); if (result == 0) result = desired_fd; + /* Correct a cygwin 1.5.x errno value. */ + else if (result == -1 && errno == EMFILE) + errno = EBADF; return result; } diff --git a/lib/pipe2.c b/lib/pipe2.c index d3b612d440..7def1b15c2 100644 --- a/lib/pipe2.c +++ b/lib/pipe2.c @@ -23,6 +23,8 @@ #include #include +#include "binary-io.h" + #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ /* Native Woe32 API. */