summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-10-22 23:03:02 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-10-22 23:03:02 +0000
commite7ff29581b10da03be7b83f5e99e31e380573fd7 (patch)
tree2b1eafebb9be780b9d8c24861d1fbcf5176a538a /io.c
parentdf8126f9e3728771fa7d0dc319a14d9d33d505c5 (diff)
* io.c (rb_fd_set_cloexec): set close-on-exec flag only if F_GETFD is
defined. reported by Luis Lavena. [ruby-core:40281] [Bug #5470] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/io.c b/io.c
index c4980a2c8b..c9a33f3aad 100644
--- a/io.c
+++ b/io.c
@@ -159,6 +159,8 @@ rb_update_max_fd(int fd)
void rb_fd_set_cloexec(int fd)
{
+ /* MinGW don't have F_GETFD and FD_CLOEXEC. [ruby-core:40281] */
+#ifdef F_GETFD
int flags, ret;
flags = fcntl(fd, F_GETFD); /* should not fail except EBADF. */
if (flags == -1) {
@@ -173,6 +175,7 @@ void rb_fd_set_cloexec(int fd)
}
}
}
+#endif
if (max_file_descriptor < fd) max_file_descriptor = fd;
}