summaryrefslogtreecommitdiff
path: root/random.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-10-29 04:01:54 (GMT)
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-10-29 04:01:54 (GMT)
commitda74bc75523ef4054030e5f3cf4aac3e9bfe8715 (patch)
tree3b197501d1fb7f83ebc91a060e00dfc1d531e62c /random.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 'random.c')
-rw-r--r--random.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/random.c b/random.c
index e55e4e7..36b45a5 100644
--- a/random.c
+++ b/random.c
@@ -498,15 +498,15 @@ fill_random_seed(unsigned int seed[DEFAULT_SEED_CNT])
memset(seed, 0, DEFAULT_SEED_LEN);
#if USE_DEV_URANDOM
- if ((fd = open("/dev/urandom", O_RDONLY
+ if ((fd = rb_cloexec_open("/dev/urandom", O_RDONLY
#ifdef O_NONBLOCK
|O_NONBLOCK
#endif
#ifdef O_NOCTTY
|O_NOCTTY
#endif
- )) >= 0) {
- rb_fd_set_cloexec(fd);
+ , 0)) >= 0) {
+ rb_update_max_fd(fd);
if (fstat(fd, &statbuf) == 0 && S_ISCHR(statbuf.st_mode)) {
if (read(fd, seed, DEFAULT_SEED_LEN) < DEFAULT_SEED_LEN) {
/* abandon */;