summaryrefslogtreecommitdiffstats
path: root/crypto/rand/rand_egd.c
diff options
context:
space:
mode:
authorganesh <ganeshbhambarkar@gmail.com>2016-11-09 20:44:22 +0530
committerRichard Levitte <levitte@openssl.org>2017-01-24 14:39:20 +0100
commit1381684daf8800487b48a70cd634f433b1d6366f (patch)
tree144c9d2104adcf1d0a40eb61ea16eb809b33394a /crypto/rand/rand_egd.c
parent8f77fab82486c19ab48eee07718e190f76e6ea9a (diff)
Fixed the return code of RAND_query_egd_bytes when connect fails.
Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1886)
Diffstat (limited to 'crypto/rand/rand_egd.c')
-rw-r--r--crypto/rand/rand_egd.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/crypto/rand/rand_egd.c b/crypto/rand/rand_egd.c
index fb6bad70dc..5fb230fa95 100644
--- a/crypto/rand/rand_egd.c
+++ b/crypto/rand/rand_egd.c
@@ -133,6 +133,7 @@ int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes)
break;
# endif
default:
+ ret = -1;
goto err; /* failure */
}
}
@@ -230,9 +231,7 @@ int RAND_egd_bytes(const char *path, int bytes)
int num, ret = 0;
num = RAND_query_egd_bytes(path, NULL, bytes);
- if (num < 1)
- goto err;
- if (RAND_status() == 1)
+ if (num < 1 || RAND_status() == 1)
ret = num;
err:
return (ret);