From: Kevin McCarthy Date: Sat, 22 Jun 2019 19:35:58 +0000 (-0700) Subject: Fix compose and edit attachment symlink failure code. X-Git-Tag: mutt-1-12-2-rel~8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a99a75b7ab1f52b83a69c40a3ff67833bcbb38ba;p=mutt 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. --- 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;