From aeeb861a7744110d0cd0c0a44d860ece975e67f2 Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Wed, 14 Apr 2021 18:40:46 +0200 Subject: [PATCH] Fix possible double-fclose --- pinentry-1.1.1-coverity.patch | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/pinentry-1.1.1-coverity.patch b/pinentry-1.1.1-coverity.patch index 73b92aa..8df88f5 100644 --- a/pinentry-1.1.1-coverity.patch +++ b/pinentry-1.1.1-coverity.patch @@ -95,3 +95,38 @@ index 403dd60..4a2b67f 100644 rc = -1; if (! rc) +commit 75568e8bea256657258f79d3f1a0736198d05b60 +Author: Jakub Jelen +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 + +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) + {