If multiple PGP blocks are present in an email, Mutt only cleans up the
tempfiles for the last block. Thanks to Dennis Preiser for the patch
and sample mbox file demonstrating the problem.
This patch also fixes the argument to mutt_perror for the pgpout
tempfile.
mutt_mktemp (outfile, sizeof (outfile));
if ((pgpout = safe_fopen (outfile, "w+")) == NULL)
{
- mutt_perror (tmpfname);
+ mutt_perror (outfile);
return -1;
}
fgetconv_close (&fc);
}
+ /*
+ * Multiple PGP blocks can exist, so these need to be closed and
+ * unlinked inside the loop.
+ */
+ safe_fclose (&tmpfp);
+ mutt_unlink (tmpfname);
+ if (pgpout)
+ {
+ safe_fclose (&pgpout);
+ mutt_unlink (outfile);
+ }
+
if (s->flags & M_DISPLAY)
{
state_putc ('\n', s);