diff options
author | krakjoe <krakjoe@php.net> | 2017-11-22 04:32:24 +0000 |
---|---|---|
committer | krakjoe <krakjoe@php.net> | 2017-11-22 04:32:42 +0000 |
commit | 1362c849e8d4e1866d3a60b0d5e105e70db77437 (patch) | |
tree | 31e57544217aee45cafc6084e08fa79a634ab382 /ext/standard | |
parent | 62e96c2b6f0eccfdcdd4450fdc8e18528cfe2b9f (diff) | |
parent | 5a7459a08202a893eca6fb8dedd7b007c9c8a219 (diff) | |
download | php-git-1362c849e8d4e1866d3a60b0d5e105e70db77437.tar.gz |
Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
Fix bug #75409
Diffstat (limited to 'ext/standard')
-rw-r--r-- | ext/standard/random.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/ext/standard/random.c b/ext/standard/random.c index 202d272f58..3402c4816d 100644 --- a/ext/standard/random.c +++ b/ext/standard/random.c @@ -122,16 +122,10 @@ PHPAPI int php_random_bytes(void *bytes, size_t size, zend_bool should_throw) } else if (errno == EINTR || errno == EAGAIN) { /* Try again */ continue; + } else { + /* If the syscall fails, fall back to reading from /dev/urandom */ + break; } - /* - If the syscall fails, we are doomed. The loop that calls - php_random_bytes should be terminated by the exception instead - of proceeding to demand more entropy. - */ - if (should_throw) { - zend_throw_exception(zend_ce_exception, "Could not gather sufficient random data", errno); - } - return FAILURE; } read_bytes += (size_t) n; |