summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-10-29 04:01:54 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-10-29 04:01:54 +0000
commitda74bc75523ef4054030e5f3cf4aac3e9bfe8715 (patch)
tree3b197501d1fb7f83ebc91a060e00dfc1d531e62c /file.c
parent3ae3cd741d4ac85e2cd53c588318afb582412fd9 (diff)
* 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
Diffstat (limited to 'file.c')
-rw-r--r--file.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/file.c b/file.c
index 3107895037..c38ce7dc40 100644
--- a/file.c
+++ b/file.c
@@ -3914,10 +3914,10 @@ rb_file_s_truncate(VALUE klass, VALUE path, VALUE len)
{
int tmpfd;
- if ((tmpfd = open(StringValueCStr(path), 0)) < 0) {
+ if ((tmpfd = rb_cloexec_open(StringValueCStr(path), 0, 0)) < 0) {
rb_sys_fail(RSTRING_PTR(path));
}
- rb_fd_set_cloexec(tmpfd);
+ rb_update_max_fd(tmpfd);
if (chsize(tmpfd, pos) < 0) {
close(tmpfd);
rb_sys_fail(RSTRING_PTR(path));
@@ -5063,9 +5063,9 @@ static int
file_load_ok(const char *path)
{
int ret = 1;
- int fd = open(path, O_RDONLY);
+ int fd = rb_cloexec_open(path, O_RDONLY, 0);
if (fd == -1) return 0;
- rb_fd_set_cloexec(fd);
+ rb_update_max_fd(fd);
#if !defined DOSISH
{
struct stat st;