From 84fd2d1d61205018c18448b11808c84f6f8b4dd6 Mon Sep 17 00:00:00 2001 From: kosaki Date: Sun, 18 Oct 2015 05:43:08 +0000 Subject: * random.c (fill_random_bytes_urandom): add a comment why using O_NONBLOCK and O_NOCTTY. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52181 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- random.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'random.c') diff --git a/random.c b/random.c index 3fcc4243e6..e73e3dec06 100644 --- a/random.c +++ b/random.c @@ -455,6 +455,11 @@ random_init(int argc, VALUE *argv, VALUE obj) static int fill_random_bytes_urandom(void *seed, size_t size) { + /* + O_NONBLOCK and O_NOCTTY is meaningless if /dev/urandom correctly point + to urandom device. But it protect from several strange hazard if + /dev/urandom is not urandom device. + */ int fd = rb_cloexec_open("/dev/urandom", # ifdef O_NONBLOCK O_NONBLOCK| -- cgit v1.2.3