diff --git a/ChangeLog b/ChangeLog index 0699c13101..3b7a23bc1a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Tue Jul 7 16:39:04 2015 Eric Wong + + * random.c (fill_random_bytes_syscall): return -1 for error + * random.c (fill_random_bytes): try urandom on syscall failure + Tue Jul 7 15:02:18 2015 Nobuyoshi Nakada * file.c (rb_str_normalize_ospath): skip invalid byte sequence not diff --git a/random.c b/random.c index 853c287040..b66f5cbe4e 100644 --- a/random.c +++ b/random.c @@ -529,7 +529,7 @@ fill_random_bytes_syscall(void *seed, size_t size) } if ((size_t)ret == size) return 0; } - return 0; + return -1; } #else # define fill_random_bytes_syscall(seed, size) -1 @@ -539,7 +539,7 @@ static int fill_random_bytes(void *seed, size_t size) { int ret = fill_random_bytes_syscall(seed, size); - if (ret) return ret; + if (ret == 0) return ret; return fill_random_bytes_urandom(seed, size); }