Update random.c

Supersedes #1589
This commit is contained in:
Scott 2015-10-21 16:04:34 -04:00 committed by Anatol Belski
parent 908f67b1d4
commit c0ce2281bc

View File

@ -102,7 +102,6 @@ PHPAPI int php_random_bytes(void *bytes, size_t size, zend_bool should_throw)
/* Keep reading until we get enough entropy */
do {
amount_to_read = size - read_bytes;
/* Below, (bytes + read_bytes) is pointer arithmetic.
bytes read_bytes size
@ -112,6 +111,7 @@ PHPAPI int php_random_bytes(void *bytes, size_t size, zend_bool should_throw)
amount_to_read
*/
amount_to_read = size - read_bytes;
n = syscall(SYS_getrandom, bytes + read_bytes, amount_to_read, 0);
if (n == -1) {