From a3e8d63a758dd32c01159f2ca8a980223ada300e Mon Sep 17 00:00:00 2001 From: usa Date: Thu, 22 Jan 2009 06:55:20 +0000 Subject: * include/ruby/win32.h, win32/win32.c (rb_w32_is_valid_fd): new function to validate fd. * io.c (rb_io_initialize): check fd with above function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- win32/win32.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'win32') diff --git a/win32/win32.c b/win32/win32.c index b948fe0d77..ba8a96e82c 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -1836,6 +1836,15 @@ rb_w32_open_osfhandle(intptr_t osfhandle, int flags) } #endif +int +rb_w32_is_valid_fd(int fd) +{ + if (_get_osfhandle(fd) == -1) + return -1; + else + return 0; +} + #undef getsockopt static int -- cgit v1.2.3