summaryrefslogtreecommitdiffstats
path: root/engines/e_devcrypto.c
diff options
context:
space:
mode:
authorEneas U de Queiroz <cote2004-github@yahoo.com>2019-02-15 15:51:59 -0200
committerRichard Levitte <levitte@openssl.org>2019-02-22 09:42:56 +0100
commit41bffb9da082e49378ef0c027beac75399315bb9 (patch)
tree9d25bc1914a3ab041c5555e06a22887f03e28284 /engines/e_devcrypto.c
parent91958d71aaea98854a9709a8489263c79a01addd (diff)
engines/e_devcrypto: fixes logic in close_devcrypto
Call close(cfd) before setting cfd = -1. Signed-off-by: Eneas U de Queiroz <cote2004-github@yahoo.com> Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/8213)
Diffstat (limited to 'engines/e_devcrypto.c')
-rw-r--r--engines/e_devcrypto.c5
1 files changed, 4 insertions, 1 deletions
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;
}