summaryrefslogtreecommitdiff
path: root/random.c
diff options
context:
space:
mode:
Diffstat (limited to 'random.c')
-rw-r--r--random.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/random.c b/random.c
index 704f78d44d..a21f684325 100644
--- a/random.c
+++ b/random.c
@@ -398,21 +398,21 @@ fill_random_bytes_syscall(void *seed, size_t size, int need_secure)
{
static rb_atomic_t try_syscall = 1;
if (try_syscall) {
- ssize_t ret;
- size_t offset = 0;
- int flags = 0;
- if (!need_secure)
- flags = GRND_NONBLOCK;
- do {
- errno = 0;
- ret = getrandom(((char*)seed) + offset, size - offset, flags);
- if (ret == -1) {
- ATOMIC_SET(try_syscall, 0);
- return -1;
- }
- offset += (size_t)ret;
- } while(offset < size);
- return 0;
+ ssize_t ret;
+ size_t offset = 0;
+ int flags = 0;
+ if (!need_secure)
+ flags = GRND_NONBLOCK;
+ do {
+ errno = 0;
+ ret = getrandom(((char*)seed) + offset, size - offset, flags);
+ if (ret == -1) {
+ ATOMIC_SET(try_syscall, 0);
+ return -1;
+ }
+ offset += (size_t)ret;
+ } while(offset < size);
+ return 0;
}
return -1;
}