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

* ext/socket/socket.c (sock_listen): get OpenFile just before calling

listen(2).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7527 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2004-12-09 23:39:57 +00:00
parent d9a56b4fee
commit bb59e412e1
3 changed files with 22 additions and 1 deletions

View file

@ -1,3 +1,8 @@
Fri Dec 10 08:39:48 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/socket/socket.c (sock_listen): get OpenFile just before calling
listen(2).
Thu Dec 9 16:28:35 2004 NAKAMURA Usaku <usa@ruby-lang.org>
* ext/sdbm/init.c (GetDBM): typo.

View file

@ -2013,10 +2013,12 @@ sock_listen(sock, log)
VALUE sock, log;
{
OpenFile *fptr;
int backlog;
rb_secure(4);
backlog = NUM2INT(log);
GetOpenFile(sock, fptr);
if (listen(fptr->fd, NUM2INT(log)) < 0)
if (listen(fptr->fd, backlog) < 0)
rb_sys_fail("listen(2)");
return INT2FIX(0);

View file

@ -57,4 +57,18 @@ class TestBasicSocket < Test::Unit::TestCase
}
end
end
def test_listen
s = nil
log = Object.new
class << log; self end.send(:define_method, :to_int) {
s.close
2
}
inet_stream do |s|
assert_raise(IOError) {
s.listen(log)
}
end
end
end if defined?(Socket)