1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* expand tabs.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
svn 2019-02-10 08:21:39 +00:00
parent 1a8583de72
commit 61ffc7a0ae

View file

@ -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;
}