diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-07-20 13:26:10 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-07-20 13:26:10 +0000 |
commit | b41ccc4a9c4d4900e79642bb98ad87b2ba63e766 (patch) | |
tree | 39f42db7feb39f86e952030c29de292d295f8a3b /ext/socket/init.c | |
parent | 13f62a384b48a5e8ade2319e102a6aa31a0321c9 (diff) |
* include/ruby/intern.h (rb_update_max_fd): declaration moved from
internal.h.
* file.c: ditto.
* io.c: call rb_update_max_fd for each new fds.
* process.c: ditto.
* random.c: ditto.
* ruby.c: ditto.
* ext/io/console/console.c: ditto.
* ext/openssl/ossl_bio.c: ditto.
* ext/pty/pty.c: ditto.
* ext/socket/init.c: ditto.
* ext/socket/socket.c: ditto.
* ext/socket/ancdata.c: ditto.
* ext/socket/unixsocket.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32587 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket/init.c')
-rw-r--r-- | ext/socket/init.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/ext/socket/init.c b/ext/socket/init.c index e55736cabe..8df1aee9bf 100644 --- a/ext/socket/init.c +++ b/ext/socket/init.c @@ -48,6 +48,7 @@ rsock_init_sock(VALUE sock, int fd) if (fstat(fd, &sbuf) < 0) rb_sys_fail(0); + rb_update_max_fd(fd); if (!S_ISSOCK(sbuf.st_mode)) rb_raise(rb_eArgError, "not a socket file descriptor"); #else @@ -250,6 +251,8 @@ rsock_socket(int domain, int type, int proto) fd = socket(domain, type, proto); } } + if (0 <= fd) + rb_update_max_fd(fd); return fd; } @@ -463,6 +466,7 @@ rsock_s_accept_nonblock(VALUE klass, rb_io_t *fptr, struct sockaddr *sockaddr, s } rb_sys_fail("accept(2)"); } + rb_update_max_fd(fd2); make_fd_nonblock(fd2); return rsock_init_sock(rb_obj_alloc(klass), fd2); } @@ -509,6 +513,7 @@ rsock_s_accept(VALUE klass, int fd, struct sockaddr *sockaddr, socklen_t *len) } rb_sys_fail(0); } + rb_update_max_fd(fd2); if (!klass) return INT2NUM(fd2); return rsock_init_sock(rb_obj_alloc(klass), fd2); } |