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

index a1fb0d26dc4a12fb28be11b603a78916721e8852..144b75c60628af4fbd0c25926e0a97e06c526bcf 100644 (file)
@@ -2693,16 +2693,15 @@ int pgp_gpgme_application_handler(struct Body *m, struct State *s)
  */
 int pgp_gpgme_encrypted_handler(struct Body *a, struct State *s)
 {
-  char tempfile[PATH_MAX];
   int is_signed;
   int rc = 0;
 
   mutt_debug(2, "Entering handler\n");
 
-  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! "
@@ -2759,7 +2758,6 @@ int pgp_gpgme_encrypted_handler(struct Body *a, struct State *s)
   }
 
   mutt_file_fclose(&fpout);
-  mutt_file_unlink(tempfile);
   mutt_debug(2, "Leaving handler\n");
 
   return rc;