com php-src: improve condition: ext/standard/random.c
| From: | Anatol Belski | Date: | Wed, 12 Aug 2015 08:20:26 +0000 |
| Subject: | com php-src: improve condition: ext/standard/random.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-88486@lists.php.net to get a copy of this message | ||
Commit: cbcacbb2dad4c97ba5653f42729f7956193d9112
Author: Anatol Belski <ab@php.net> Wed, 12 Aug 2015 10:20:26 +0200
Parents: 1a2c5bc18006dc2c8249a8039046c08ff8c66325
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=cbcacbb2dad4c97ba5653f42729f7956193d9112
Log:
improve condition
read() == 0 is EOL
Changed paths:
M ext/standard/random.c
Diff:
diff --git a/ext/standard/random.c b/ext/standard/random.c
index cc15012..9ae4e3c 100644
--- a/ext/standard/random.c
+++ b/ext/standard/random.c
@@ -104,7 +104,7 @@ static int php_random_bytes(void *bytes, size_t size)
while (read_bytes < size) {
ssize_t n = read(fd, bytes + read_bytes, size - read_bytes);
- if (n < 0) {
+ if (n <= 0) {
break;
}
read_bytes += n;