- command, sizeof (command));
- use_pager = entry->copiousoutput;
+@@ -633,7 +634,11 @@ int mutt_view_attachment (FILE *fp, BODY
+ if (entry)
+ rfc1524_free_entry (&entry);
+ if (fp && tempfile[0])
++ {
++ /* Restore write permission so mutt_unlink can open the file for writing */
++ chmod(tempfile, 0600);
+ mutt_unlink (tempfile);
++ }
+ else if (unlink_tempfile)
+ unlink(tempfile);
+