mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Revert r52180
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52182 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
6c060b2b58
commit
0751bc3fad
2 changed files with 5 additions and 8 deletions
|
@ -3,13 +3,6 @@ Sun Oct 18 14:37:56 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||||
* random.c (fill_random_bytes_urandom): add a comment why using
|
* random.c (fill_random_bytes_urandom): add a comment why using
|
||||||
O_NONBLOCK and O_NOCTTY.
|
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.
|
|
||||||
It is meaningless. If SYS_getrandom(GRND_NONBLOCK) return
|
|
||||||
EAGAIN, we eventually call fill_random_bytes_urandom() and
|
|
||||||
it block such as SYS_getrandom() without GRND_NONBLOCK.
|
|
||||||
|
|
||||||
Sun Oct 18 13:24:17 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
Sun Oct 18 13:24:17 2015 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||||
|
|
||||||
* random.c (fill_random_bytes_syscall): use ATOMIC_SET() for
|
* random.c (fill_random_bytes_syscall): use ATOMIC_SET() for
|
||||||
|
|
6
random.c
6
random.c
|
@ -523,6 +523,10 @@ fill_random_bytes_syscall(void *seed, size_t size)
|
||||||
#elif defined __linux__ && defined SYS_getrandom
|
#elif defined __linux__ && defined SYS_getrandom
|
||||||
#include <linux/random.h>
|
#include <linux/random.h>
|
||||||
|
|
||||||
|
# ifndef GRND_NONBLOCK
|
||||||
|
# define GRND_NONBLOCK 0x0001 /* not defined in musl libc */
|
||||||
|
# endif
|
||||||
|
|
||||||
static int
|
static int
|
||||||
fill_random_bytes_syscall(void *seed, size_t size)
|
fill_random_bytes_syscall(void *seed, size_t size)
|
||||||
{
|
{
|
||||||
|
@ -530,7 +534,7 @@ fill_random_bytes_syscall(void *seed, size_t size)
|
||||||
if (try_syscall) {
|
if (try_syscall) {
|
||||||
long ret;
|
long ret;
|
||||||
errno = 0;
|
errno = 0;
|
||||||
ret = syscall(SYS_getrandom, seed, size, 0);
|
ret = syscall(SYS_getrandom, seed, size, GRND_NONBLOCK);
|
||||||
if (errno == ENOSYS) {
|
if (errno == ENOSYS) {
|
||||||
ATOMIC_SET(try_syscall, 0);
|
ATOMIC_SET(try_syscall, 0);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue