From f46cff647e8999b09e72fb8353de6fcd0c007cc1 Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 31 Jul 2011 09:59:01 +0000 Subject: [PATCH] * io.c (rb_pipe): pipe on cygwin can succeed half but fail half. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32771 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ io.c | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/ChangeLog b/ChangeLog index 940453d7d5..9bdc6df386 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sun Jul 31 18:58:59 2011 Nobuyoshi Nakada + + * io.c (rb_pipe): pipe on cygwin can succeed half but fail + half. + Sun Jul 31 11:31:07 2011 Kazuki Tsujimoto * vm.c: check if cfp is valid. [Bug #5083] [ruby-dev:44208] diff --git a/io.c b/io.c index 5e52ea6265..6be4e88744 100644 --- a/io.c +++ b/io.c @@ -4914,6 +4914,14 @@ rb_pipe(int *pipes) ret = pipe(pipes); } } +#ifdef __CYGWIN__ + if (ret == 0 && pipes[1] == -1) { + close(pipes[0]); + pipes[0] = -1; + errno = ENFILE; + return -1; + } +#endif if (ret == 0) { rb_update_max_fd(pipes[0]); rb_update_max_fd(pipes[1]);