mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 08:33:58 +02:00
* include/ruby/intern.h (rb_fd_set_cloexec): declared.
* io.c (rb_fd_set_cloexec): new function. (ruby_dup): call rb_fd_set_cloexec to set close-on-exec flag. (rb_sysopen_internal): ditto. (rb_pipe): ditto. (io_reopen): ditto. (io_cntl): ditto. * process.c (rb_f_exec): change the default :close_others option to true. (rb_f_system): ditto. (move_fds_to_avoid_crash): call rb_fd_set_cloexec to set close-on-exec flag. (ruby_setsid): ditto. (rb_daemon): ditto. * thread_pthread.c (rb_thread_create_timer_thread): call rb_fd_set_cloexec to set close-on-exec flag. * ruby.c (load_file_internal): ditto. * file.c (rb_file_s_truncate): ditto. (file_load_ok): ditto. * random.c (fill_random_seed): ditto. * ext/pty/pty.c (chfunc): ditto. (get_device_once): ditto. * ext/openssl/ossl_bio.c (ossl_obj2bio): ditto. * ext/socket/init.c (rsock_socket): ditto. (rsock_s_accept_nonblock): ditto. (rsock_s_accept): ditto. * ext/socket/socket.c (rsock_sock_s_socketpair): ditto. * ext/socket/ancdata.c (discard_cmsg): ditto. (make_io_for_unix_rights): ditto. * ext/socket/unixsocket.c (unix_recv_io): ditto. * ext/io/console/console.c (console_dev): ditto. [ruby-core:38140] [Feature #5041] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
00715f4c5a
commit
b574a4d4a1
18 changed files with 133 additions and 46 deletions
|
@ -252,7 +252,7 @@ rsock_socket(int domain, int type, int proto)
|
|||
}
|
||||
}
|
||||
if (0 <= fd)
|
||||
rb_update_max_fd(fd);
|
||||
rb_fd_set_cloexec(fd);
|
||||
return fd;
|
||||
}
|
||||
|
||||
|
@ -466,7 +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);
|
||||
rb_fd_set_cloexec(fd2);
|
||||
make_fd_nonblock(fd2);
|
||||
return rsock_init_sock(rb_obj_alloc(klass), fd2);
|
||||
}
|
||||
|
@ -513,7 +513,7 @@ rsock_s_accept(VALUE klass, int fd, struct sockaddr *sockaddr, socklen_t *len)
|
|||
}
|
||||
rb_sys_fail(0);
|
||||
}
|
||||
rb_update_max_fd(fd2);
|
||||
rb_fd_set_cloexec(fd2);
|
||||
if (!klass) return INT2NUM(fd2);
|
||||
return rsock_init_sock(rb_obj_alloc(klass), fd2);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue