mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/socket/init.c (rsock_init_sock): validate file descriptor.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25336 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b97494f3cb
commit
05eb304947
2 changed files with 10 additions and 0 deletions
|
@ -1,3 +1,7 @@
|
|||
Thu Oct 15 00:26:07 2009 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* ext/socket/init.c (rsock_init_sock): validate file descriptor.
|
||||
|
||||
Wed Oct 14 13:24:14 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* ruby.c (process_options): script name should not be shown in an
|
||||
|
|
|
@ -43,6 +43,12 @@ VALUE
|
|||
rsock_init_sock(VALUE sock, int fd)
|
||||
{
|
||||
rb_io_t *fp;
|
||||
struct stat sbuf;
|
||||
|
||||
if (fstat(fd, &sbuf) < 0)
|
||||
rb_sys_fail(0);
|
||||
if (!S_ISSOCK(sbuf.st_mode))
|
||||
rb_raise(rb_eArgError, "not a socket file descriptor");
|
||||
|
||||
MakeOpenFile(sock, fp);
|
||||
fp->fd = fd;
|
||||
|
|
Loading…
Add table
Reference in a new issue