From da74bc75523ef4054030e5f3cf4aac3e9bfe8715 Mon Sep 17 00:00:00 2001 From: akr Date: Sat, 29 Oct 2011 04:01:54 +0000 Subject: * process.c (ruby_setsid): use rb_cloexec_open. (rb_daemon): ditto. * 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/io/console/console.c (console_dev): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33550 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- process.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'process.c') diff --git a/process.c b/process.c index 10020f6095..1e91743648 100644 --- a/process.c +++ b/process.c @@ -3558,8 +3558,8 @@ ruby_setsid(void) #endif if (ret == -1) return -1; - if ((fd = open("/dev/tty", O_RDWR)) >= 0) { - rb_fd_set_cloexec(fd); + if ((fd = rb_cloexec_open("/dev/tty", O_RDWR, 0)) >= 0) { + rb_update_max_fd(fd); ioctl(fd, TIOCNOTTY, NULL); close(fd); } @@ -4849,8 +4849,8 @@ rb_daemon(int nochdir, int noclose) if (!nochdir) err = chdir("/"); - if (!noclose && (n = open("/dev/null", O_RDWR, 0)) != -1) { - rb_fd_set_cloexec(n); + if (!noclose && (n = rb_cloexec_open("/dev/null", O_RDWR, 0)) != -1) { + rb_update_max_fd(n); (void)dup2(n, 0); (void)dup2(n, 1); (void)dup2(n, 2); -- cgit v1.2.3