From 2921991916ba2362d054111a0d041ff170c899c1 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Mon, 13 Aug 2018 21:30:07 +0100 Subject: [PATCH] progs/catsign.c: Don't gratuitously try to open a temporary file. The `merry dance' where we open the necessary output files was bungled, which caused a temporary file to be opened unless an explicit output file was requested without buffering. --- progs/catsign.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/progs/catsign.c b/progs/catsign.c index accd592f..3cce9c93 100644 --- a/progs/catsign.c +++ b/progs/catsign.c @@ -749,14 +749,14 @@ static int verify(int argc, char *argv[]) } else if (!of || strcmp(of, "-") == 0) { v.f |= F_BUFFER; ofp = stdout; - } - if (of && !(v.f & F_BUFFER)) { + } else if (of && !(v.f & F_BUFFER)) { if ((ofp = fopen(of, (v.f & F_BINARY) ? "wb" : "w")) == 0) { die(EXIT_FAILURE, "couldn't open file `%s' for output: %s", of, strerror(errno)); } rfp = ofp; - } else if ((rfp = tmpfile()) == 0) + } + if ((v.f & F_BUFFER) && (rfp = tmpfile()) == 0) die(EXIT_FAILURE, "couldn't create temporary file: %s", strerror(errno)); /* --- Read the message and verify the signature --- */ -- 2.11.0