]> granicus.if.org Git - mutt/commitdiff
Fix compose and edit attachment symlink failure code.
authorKevin McCarthy <kevin@8t8.us>
Sat, 22 Jun 2019 19:35:58 +0000 (12:35 -0700)
committerKevin McCarthy <kevin@8t8.us>
Sat, 22 Jun 2019 19:35:58 +0000 (12:35 -0700)
In the case where safe_symlink() fail, mutt prompts to continue, but
did not properly reset the filename to be operated on.

Fix up mutt_view_attachment() to use the same flow as the others, to
allow for easier comparison.

attach.c

index 9006684c33d9571b578c899ea5d86f9f32e669c2..04a5610b0ade675e37be5b7dfc602415c9c92444 100644 (file)
--- a/attach.c
+++ b/attach.c
@@ -121,6 +121,7 @@ int mutt_compose_attachment (BODY *a)
        {
          if (mutt_yesorno (_("Can't match nametemplate, continue?"), MUTT_YES) != MUTT_YES)
            goto bailout;
+          mutt_buffer_strcpy (newfile, a->filename);
        }
        else
          unlink_newfile = 1;
@@ -256,6 +257,7 @@ int mutt_edit_attachment (BODY *a)
        {
          if (mutt_yesorno (_("Can't match nametemplate, continue?"), MUTT_YES) != MUTT_YES)
            goto bailout;
+          mutt_buffer_strcpy (newfile, a->filename);
        }
        else
          unlink_newfile = 1;
@@ -418,10 +420,9 @@ int mutt_view_attachment (FILE *fp, BODY *a, int flag, HEADER *hdr,
        /* send case: the file is already there */
        if (safe_symlink (a->filename, mutt_b2s (tempfile)) == -1)
        {
-         if (mutt_yesorno (_("Can't match nametemplate, continue?"), MUTT_YES) == MUTT_YES)
-           mutt_buffer_strcpy (tempfile, a->filename);
-         else
+         if (mutt_yesorno (_("Can't match nametemplate, continue?"), MUTT_YES) != MUTT_YES)
            goto return_error;
+          mutt_buffer_strcpy (tempfile, a->filename);
        }
        else
          unlink_tempfile = 1;