summaryrefslogtreecommitdiff
path: root/random.c
diff options
context:
space:
mode:
authorkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-10-18 05:46:21 (GMT)
committerkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-10-18 05:46:21 (GMT)
commit0751bc3fad795d49fe844afe9b7c2a67d43b149f (patch)
treece66f02232b8fac5385898e923392feffd99bbc7 /random.c
parent6c060b2b581288f67417eabdcf20acc6f154001e (diff)
Revert r52180
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52182 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'random.c')
-rw-r--r--random.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/random.c b/random.c
index e73e3de..d8b3c72 100644
--- a/random.c
+++ b/random.c
@@ -523,6 +523,10 @@ fill_random_bytes_syscall(void *seed, size_t size)
#elif defined __linux__ && defined SYS_getrandom
#include <linux/random.h>
+# ifndef GRND_NONBLOCK
+# define GRND_NONBLOCK 0x0001 /* not defined in musl libc */
+# endif
+
static int
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) {
long ret;
errno = 0;
- ret = syscall(SYS_getrandom, seed, size, 0);
+ ret = syscall(SYS_getrandom, seed, size, GRND_NONBLOCK);
if (errno == ENOSYS) {
ATOMIC_SET(try_syscall, 0);
return -1;