summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-12-15 05:31:32 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-12-15 05:31:32 +0000
commit6f3923f29e8b753a1e1eb0f924eec73330e3f931 (patch)
tree6c83ccf0adf1bc1c938e5ac87a2f81fe221c702d /win32
parent4785d53be1884a7ec18234c421a716ddabdebc24 (diff)
* win32/win32.c (rb_w32_fdisset): check whether the handle is valid.
fixed: [ruby-core:03959] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7560 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
-rw-r--r--win32/win32.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/win32/win32.c b/win32/win32.c
index 72ca08f55e..a4cea9b287 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -1811,7 +1811,12 @@ rb_w32_fdclr(int fd, fd_set *set)
int
rb_w32_fdisset(int fd, fd_set *set)
{
- return __WSAFDIsSet(TO_SOCKET(fd), set);
+ int ret;
+ SOCKET s = TO_SOCKET(fd);
+ if (s == (SOCKET)INVALID_HANDLE_VALUE)
+ return 0;
+ RUBY_CRITICAL(ret = __WSAFDIsSet(s, set));
+ return ret;
}
//