From e4d1745717744eec8800d5b39a5b22c796889b8d Mon Sep 17 00:00:00 2001 From: usa Date: Thu, 15 Oct 2009 00:29:10 +0000 Subject: [PATCH] * 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@25339 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ ext/socket/init.c | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/ChangeLog b/ChangeLog index a67a52ec0f..e36c9314e7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Thu Oct 15 09:25:07 2009 NAKAMURA Usaku + + * 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. + Thu Oct 15 00:47:42 2009 NARUSE, Yui * tool/enc-unicode.rb, diff --git a/ext/socket/init.c b/ext/socket/init.c index 85cc3de4f9..b143dccd5f 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;