mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* random.c (fill_random_bytes_syscall): fix compile error.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51186 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7c94c0283f
commit
4f66d02c97
2 changed files with 10 additions and 5 deletions
|
@ -1,3 +1,7 @@
|
|||
Tue Jul 7 18:18:41 2015 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
|
||||
|
||||
* random.c (fill_random_bytes_syscall): fix compile error.
|
||||
|
||||
Tue Jul 7 16:47:30 2015 Eric Wong <e@80x24.org>
|
||||
|
||||
* compile.c (COMPILE_ERROR): reduce GET_THREAD() calls
|
||||
|
|
11
random.c
11
random.c
|
@ -521,12 +521,13 @@ fill_random_bytes_syscall(void *seed, size_t size)
|
|||
{
|
||||
static rb_atomic_t try_syscall = 1;
|
||||
if (try_syscall) {
|
||||
int ret;
|
||||
errno = 0;
|
||||
ret = syscall(SYS_getrandom, seed, size, 0)
|
||||
if (errno == ENOSYS) {
|
||||
try_syscall = 0;
|
||||
return -1;
|
||||
}
|
||||
ret = syscall(SYS_getrandom, seed, size, 0);
|
||||
if (errno == ENOSYS) {
|
||||
try_syscall = 0;
|
||||
return -1;
|
||||
}
|
||||
if ((size_t)ret == size) return 0;
|
||||
}
|
||||
return -1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue