summaryrefslogtreecommitdiffstats
path: root/crypto/rand
diff options
context:
space:
mode:
authorganesh <ganeshbhambarkar@gmail.com>2016-11-10 16:46:43 +0530
committerRichard Levitte <levitte@openssl.org>2017-01-24 14:39:20 +0100
commit3ed93c863374125296954edcbc595599adbd07ea (patch)
tree9291c5ca74ef7b7a28ed8f9eef550df319e9fea8 /crypto/rand
parent1381684daf8800487b48a70cd634f433b1d6366f (diff)
Fixed the return code for RAND_egd_bytes.
According to the documentation, the return code should be -1 when RAND_status does not return 1. 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')
-rw-r--r--crypto/rand/rand_egd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/crypto/rand/rand_egd.c b/crypto/rand/rand_egd.c
index 5fb230fa95..f77af415c0 100644
--- a/crypto/rand/rand_egd.c
+++ b/crypto/rand/rand_egd.c
@@ -228,10 +228,10 @@ int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes)
int RAND_egd_bytes(const char *path, int bytes)
{
- int num, ret = 0;
+ int num, ret = -1;
num = RAND_query_egd_bytes(path, NULL, bytes);
- if (num < 1 || RAND_status() == 1)
+ if (RAND_status() == 1)
ret = num;
err:
return (ret);