From a99a75b7ab1f52b83a69c40a3ff67833bcbb38ba Mon Sep 17 00:00:00 2001 From: Kevin McCarthy Date: Sat, 22 Jun 2019 12:35:58 -0700 Subject: [PATCH] Fix compose and edit attachment symlink failure code. 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 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/attach.c b/attach.c index 9006684c..04a5610b 100644 --- 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; -- 2.50.1