]> granicus.if.org Git - neomutt/commitdiff
Remove tempfile from pgp_class_encrypted_handler
authorMarco Sirabella <marco@sirabella.org>
Fri, 22 Jun 2018 16:52:06 +0000 (12:52 -0400)
committerRichard Russon <rich@flatcap.org>
Sat, 23 Jun 2018 14:05:53 +0000 (15:05 +0100)
ncrypt/pgp.c

index b77a56e5be4ff29e995cc2056ae2e41bb30ea8ac..8115bfac4f3ec2c95c20e7b38a9b41e14a3b2449 100644 (file)
@@ -1119,15 +1119,14 @@ bail:
  */
 int pgp_class_encrypted_handler(struct Body *a, struct State *s)
 {
-  char tempfile[PATH_MAX];
   FILE *fpin = NULL;
   struct Body *tattach = NULL;
   int rc = 0;
 
-  mutt_mktemp(tempfile, sizeof(tempfile));
-  FILE *fpout = mutt_file_fopen(tempfile, "w+");
+  FILE *fpout = mutt_file_mkstemp();
   if (!fpout)
   {
+    mutt_perror("mutt_file_mkstemp() failed!");
     if (s->flags & MUTT_DISPLAY)
       state_attach_puts(_("[-- Error: could not create temporary file! --]\n"), s);
     return -1;
@@ -1179,7 +1178,6 @@ int pgp_class_encrypted_handler(struct Body *a, struct State *s)
   }
 
   mutt_file_fclose(&fpout);
-  mutt_file_unlink(tempfile);
 
   return rc;
 }