From: ganesh Date: Thu, 10 Nov 2016 11:16:43 +0000 (+0530) Subject: Fixed the return code for RAND_egd_bytes. X-Git-Tag: OpenSSL_1_1_0d~22 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=03f3575c39cfc81552ee05a93b856d3b69048114;p=oweals%2Fopenssl.git 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 Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/1886) (cherry picked from commit 3ed93c863374125296954edcbc595599adbd07ea) --- 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);