]> granicus.if.org Git - neomutt/commitdiff
Remove tempfile from smime_gpgme_application_handler
authorMarco Sirabella <marco@sirabella.org>
Fri, 22 Jun 2018 18:56:51 +0000 (14:56 -0400)
committerRichard Russon <rich@flatcap.org>
Sat, 23 Jun 2018 14:52:17 +0000 (15:52 +0100)
ncrypt/crypt_gpgme.c

index 29abbc16c79e2e8a943434495b87040e8980e3d2..94d388edb2acf975a1aff4497022741dc63ad55b 100644 (file)
@@ -2765,17 +2765,16 @@ int pgp_gpgme_encrypted_handler(struct Body *a, struct State *s)
  */
 int smime_gpgme_application_handler(struct Body *a, struct State *s)
 {
-  char tempfile[PATH_MAX];
   int is_signed = 0;
   int rc = 0;
 
   mutt_debug(2, "Entering handler\n");
 
   a->warnsig = false;
-  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! "
@@ -2834,7 +2833,6 @@ int smime_gpgme_application_handler(struct Body *a, struct State *s)
   }
 
   mutt_file_fclose(&fpout);
-  mutt_file_unlink(tempfile);
   mutt_debug(2, "Leaving handler\n");
 
   return rc;