aboutsummaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io.c')
-rw-r--r--io.c8
1 files changed, 8 insertions, 0 deletions
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]);