mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
merges r25336 and r25339 from trunk into ruby_1_9_1.
-- * ext/socket/init.c (rsock_init_sock): validate file descriptor. -- * 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/branches/ruby_1_9_1@26486 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7e0875aa16
commit
4fe744b107
3 changed files with 25 additions and 1 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
Thu Oct 15 09:25:07 2009 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||
|
||||
* 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:26:07 2009 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* ext/socket/init.c (rsock_init_sock): validate file descriptor.
|
||||
|
||||
Tue Oct 13 18:54:25 2009 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
||||
|
||||
* ext/tk/variable.rb: bug fix. additional trace definition changes the
|
||||
|
|
|
@ -52,6 +52,9 @@
|
|||
#ifdef HAVE_SYS_UN_H
|
||||
#include <sys/un.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_FCNTL)
|
||||
#ifdef HAVE_SYS_SELECT_H
|
||||
|
@ -237,6 +240,17 @@ static VALUE
|
|||
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;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#define RUBY_VERSION "1.9.1"
|
||||
#define RUBY_PATCHLEVEL 391
|
||||
#define RUBY_PATCHLEVEL 392
|
||||
#define RUBY_VERSION_MAJOR 1
|
||||
#define RUBY_VERSION_MINOR 9
|
||||
#define RUBY_VERSION_TEENY 1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue