* 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
This commit is contained in:
akr 2011-10-22 23:03:02 +00:00
parent df8126f9e3
commit e7ff29581b
2 changed files with 8 additions and 0 deletions

View File

@ -1,3 +1,8 @@
Sun Oct 23 08:01:29 2011 Tanaka Akira <akr@fsij.org>
* 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]
Sat Oct 22 19:48:50 2011 Tanaka Akira <akr@fsij.org> Sat Oct 22 19:48:50 2011 Tanaka Akira <akr@fsij.org>
* test/openssl/test_ssl.rb (test_multibyte_read_write): start server * test/openssl/test_ssl.rb (test_multibyte_read_write): start server

3
io.c
View File

@ -159,6 +159,8 @@ rb_update_max_fd(int fd)
void rb_fd_set_cloexec(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; int flags, ret;
flags = fcntl(fd, F_GETFD); /* should not fail except EBADF. */ flags = fcntl(fd, F_GETFD); /* should not fail except EBADF. */
if (flags == -1) { if (flags == -1) {
@ -173,6 +175,7 @@ void rb_fd_set_cloexec(int fd)
} }
} }
} }
#endif
if (max_file_descriptor < fd) max_file_descriptor = fd; if (max_file_descriptor < fd) max_file_descriptor = fd;
} }