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 /io.c | |
parent | 13f62a384b48a5e8ade2319e102a6aa31a0321c9 (diff) | |
download | ruby-b41ccc4a9c4d4900e79642bb98ad87b2ba63e766.tar.gz |
* 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 'io.c')
-rw-r--r-- | io.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -4592,7 +4592,11 @@ sysopen_func(void *ptr) static inline int rb_sysopen_internal(struct sysopen_struct *data) { - return (int)rb_thread_blocking_region(sysopen_func, data, RUBY_UBF_IO, 0); + int fd; + fd = (int)rb_thread_blocking_region(sysopen_func, data, RUBY_UBF_IO, 0); + if (0 <= fd) + rb_update_max_fd(fd); + return fd; } static int @@ -5794,6 +5798,7 @@ io_reopen(VALUE io, VALUE nfile) /* need to keep FILE objects of stdin, stdout and stderr */ if (dup2(fd2, fd) < 0) rb_sys_fail_path(orig->pathv); + rb_update_max_fd(fd); } else { fclose(fptr->stdio_file); @@ -5801,6 +5806,7 @@ io_reopen(VALUE io, VALUE nfile) fptr->fd = -1; if (dup2(fd2, fd) < 0) rb_sys_fail_path(orig->pathv); + rb_update_max_fd(fd); fptr->fd = fd; } rb_thread_fd_close(fd); @@ -6384,6 +6390,7 @@ prep_io(int fd, int fmode, VALUE klass, const char *path) fp->mode = fmode; io_check_tty(fp); if (path) fp->pathv = rb_obj_freeze(rb_str_new_cstr(path)); + rb_update_max_fd(fd); return io; } |