Fix checking the return value of getentropy()
Reviewed-by: Andy Polyakov <appro@openssl.org>
GH: #6405
diff --git a/crypto/rand/rand_unix.c b/crypto/rand/rand_unix.c
index e698dfd..9f17494 100644
--- a/crypto/rand/rand_unix.c
+++ b/crypto/rand/rand_unix.c
@@ -249,7 +249,7 @@
*/
p_getentropy.p = DSO_global_lookup("getentropy");
if (p_getentropy.p != NULL)
- return p_getentropy.f(buf, buflen);
+ return p_getentropy.f(buf, buflen) == 0 ? buflen : 0;
/* Linux supports this since version 3.17 */
# if defined(__linux) && defined(SYS_getrandom)