summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFranziskus Kiefer <franziskuskiefer@gmail.com>2016-04-20 15:22:46 +0200
committerFranziskus Kiefer <franziskuskiefer@gmail.com>2016-04-20 15:22:46 +0200
commitffef05d80bdbd79b706d344772168d310a0d4d50 (patch)
tree00c0459ccca00648d56ac66e28b66d899bf552cf
parent220b80968e095cfeb4c830bbe51e3a3bfe372866 (diff)
downloadnss-hg-ffef05d80bdbd79b706d344772168d310a0d4d50.tar.gz
Bug 1258669 - add checks for OPT builds in unix_rand.c, r=ttaubert
-rw-r--r--lib/freebl/unix_rand.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/freebl/unix_rand.c b/lib/freebl/unix_rand.c
index c9674ea91..d2baa6dcd 100644
--- a/lib/freebl/unix_rand.c
+++ b/lib/freebl/unix_rand.c
@@ -986,7 +986,7 @@ size_t RNG_FileUpdate(const char *fileName, size_t limit)
fd = fileno(file);
/* 'file' was just opened, so this should not fail. */
PORT_Assert(fd != -1);
- while (limit > fileBytes) {
+ while (limit > fileBytes && fd != -1) {
bytes = PR_MIN(sizeof buffer, limit - fileBytes);
bytes = read(fd, buffer, bytes);
if (bytes <= 0)
@@ -1155,7 +1155,7 @@ size_t RNG_SystemRNG(void *dest, size_t maxLen)
fd = fileno(file);
/* 'file' was just opened, so this should not fail. */
PORT_Assert(fd != -1);
- while (maxLen > fileBytes) {
+ while (maxLen > fileBytes && fd != -1) {
bytes = maxLen - fileBytes;
bytes = read(fd, buffer, bytes);
if (bytes <= 0)