Remove pgperrfile from pgp_decrypt_part
authorMarco Sirabella <marco@sirabella.org>
Fri, 22 Jun 2018 16:12:31 +0000 (12:12 -0400)
committerRichard Russon <rich@flatcap.org>
Sat, 23 Jun 2018 14:52:17 +0000 (15:52 +0100)
ncrypt/pgp.c

index 0af9e9749ad62cdc342c14dec81a6b2f31acf26a..01850f7750ed86ab1499d3d586c7ff71cc1abc2b 100644 (file)
@@ -915,19 +915,16 @@ static struct Body *pgp_decrypt_part(struct Body *a, struct State *s,
   FILE *pgpin = NULL, *pgpout = NULL, *pgptmp = NULL;
   struct stat info;
   struct Body *tattach = NULL;
-  char pgperrfile[PATH_MAX];
   char pgptmpfile[PATH_MAX];
   pid_t thepid;
   int rv;
 
-  mutt_mktemp(pgperrfile, sizeof(pgperrfile));
-  FILE *pgperr = mutt_file_fopen(pgperrfile, "w+");
+  FILE *pgperr = mutt_file_mkstemp();
   if (!pgperr)
   {
-    mutt_perror(pgperrfile);
+    mutt_perror("mutt_file_mkstemp() failed!");
     return NULL;
   }
-  unlink(pgperrfile);
 
   mutt_mktemp(pgptmpfile, sizeof(pgptmpfile));
   pgptmp = mutt_file_fopen(pgptmpfile, "w");