From bfb7fe417d65efc97305e738e4a74b51bb438a55 Mon Sep 17 00:00:00 2001 From: usa Date: Thu, 15 Oct 2009 00:29:10 +0000 Subject: * ext/socket/init.c (rsock_init_sock): mswin doesn't have S_IFSOCK flag in st_mode of struct stat. so, use rb_w32_issocket() function instead of S_ISSOCK macro. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@25339 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/socket/init.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'ext/socket/init.c') diff --git a/ext/socket/init.c b/ext/socket/init.c index 85cc3de4f..b143dccd5 100644 --- a/ext/socket/init.c +++ b/ext/socket/init.c @@ -45,10 +45,15 @@ rsock_init_sock(VALUE sock, int fd) rb_io_t *fp; struct stat sbuf; +#ifndef _WIN32 if (fstat(fd, &sbuf) < 0) rb_sys_fail(0); if (!S_ISSOCK(sbuf.st_mode)) rb_raise(rb_eArgError, "not a socket file descriptor"); +#else + if (!rb_w32_is_socket(fd)) + rb_raise(rb_eArgError, "not a socket file descriptor"); +#endif MakeOpenFile(sock, fp); fp->fd = fd; -- cgit