1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
usa 2009-10-15 00:29:10 +00:00
parent d5537936ab
commit e4d1745717
2 changed files with 11 additions and 0 deletions

View file

@ -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;