From 73ff84721302f20c56090886fe1fad4cf5544da2 Mon Sep 17 00:00:00 2001 From: ganesh Date: Wed, 9 Nov 2016 20:44:22 +0530 Subject: [PATCH] Fixed the return code of RAND_query_egd_bytes when connect fails. Reviewed-by: Rich Salz Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/1886) (cherry picked from commit 1381684daf8800487b48a70cd634f433b1d6366f) --- crypto/rand/rand_egd.c | 5 ++--- 1 file 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); -- 2.25.1