From: Eneas U de Queiroz Date: Fri, 15 Feb 2019 17:51:59 +0000 (-0200) Subject: engines/e_devcrypto: fixes logic in close_devcrypto X-Git-Tag: openssl-3.0.0-alpha1~2488 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=41bffb9da082e49378ef0c027beac75399315bb9;p=oweals%2Fopenssl.git engines/e_devcrypto: fixes logic in close_devcrypto Call close(cfd) before setting cfd = -1. Signed-off-by: Eneas U de Queiroz Reviewed-by: Paul Dale Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/8213) --- diff --git a/engines/e_devcrypto.c b/engines/e_devcrypto.c index 359a48631a..c57862969e 100644 --- a/engines/e_devcrypto.c +++ b/engines/e_devcrypto.c @@ -1183,10 +1183,13 @@ static int open_devcrypto(void) static int close_devcrypto(void) { + int ret; + if (cfd < 0) return 1; + ret = close(cfd); cfd = -1; - if (close(cfd) == 0) { + if (ret != 0) { fprintf(stderr, "Error closing /dev/crypto: %s\n", strerror(errno)); return 0; }