Fix possible double-fclose

This commit is contained in:
Jakub Jelen 2021-04-14 18:40:46 +02:00
parent 6d6a8451f1
commit aeeb861a77

View File

@ -95,3 +95,38 @@ index 403dd60..4a2b67f 100644
rc = -1;
if (! rc)
commit 75568e8bea256657258f79d3f1a0736198d05b60
Author: Jakub Jelen <jjelen@redhat.com>
Date: Wed Apr 14 17:36:17 2021 +0200
tty: Avoid double fclose
* tty/pinentry-tty.c (tty_cmd_handler): Avoid double fclose
--
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
diff --git a/tty/pinentry-tty.c b/tty/pinentry-tty.c
index 4a2b67f..63e306f 100644
--- a/tty/pinentry-tty.c
+++ b/tty/pinentry-tty.c
@@ -551,9 +551,6 @@ tty_cmd_handler (pinentry_t pinentry)
ttyfo = fopen (pinentry->ttyname, "w");
if (!ttyfo)
{
- int err = errno;
- fclose (ttyfi);
- errno = err;
rc = -1;
}
}
@@ -562,7 +559,7 @@ tty_cmd_handler (pinentry_t pinentry)
if (!rc && terminal_save (fileno (ttyfi)) < 0)
rc = -1;
- if (! rc)
+ if (!rc)
{
if (terminal_setup (fileno (ttyfi), !!pinentry->pin) == -1)
{