mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
47f0a8f9d0
commit
6c060b2b58
2 changed files with 10 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
|||
Sun Oct 18 14:37:56 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||
|
||||
* random.c (fill_random_bytes_urandom): add a comment why using
|
||||
O_NONBLOCK and O_NOCTTY.
|
||||
|
||||
Sun Oct 18 13:30:56 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||
|
||||
* random.c (fill_random_bytes_syscall): don't use GRND_NONBLOCK.
|
||||
|
|
5
random.c
5
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|
|
||||
|
|
Loading…
Add table
Reference in a new issue