summaryrefslogtreecommitdiffstats
path: root/win32
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-22 06:55:20 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-22 06:55:20 +0000
commit095868b1c87f6037bc1ced0e39e764013ec95dfe (patch)
treeeaca70426fccf74f58aa13e2cb118381d0fcd8bf /win32
parent2aa659c7af88fededffcb46392c442aa49476e77 (diff)
downloadruby-095868b1c87f6037bc1ced0e39e764013ec95dfe.tar.gz
ruby-095868b1c87f6037bc1ced0e39e764013ec95dfe.tar.xz
ruby-095868b1c87f6037bc1ced0e39e764013ec95dfe.zip
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@21734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
-rw-r--r--win32/win32.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/win32/win32.c b/win32/win32.c
index b948fe0d7..ba8a96e82 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