summaryrefslogtreecommitdiffstats
path: root/attach.c
diff options
context:
space:
mode:
authorThomas Roessler <roessler@does-not-exist.org>2004-04-12 21:43:32 +0000
committerThomas Roessler <roessler@does-not-exist.org>2004-04-12 21:43:32 +0000
commit5859741bece077e8d758a9226f365e6d573db044 (patch)
tree6718a17e723cd0d900a0031a9f0fe8829a57d252 /attach.c
parent3561c82e22b42b3b099453ff3bb05eb43ba691bf (diff)
Don't open a file for writing that we have unlinked before. Reported
embarassingly long ago by Jarno Huuskonen <Jarno.Huuskonen@uku.fi>.
Diffstat (limited to 'attach.c')
-rw-r--r--attach.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/attach.c b/attach.c
index 06dc12b3..7efba875 100644
--- a/attach.c
+++ b/attach.c
@@ -108,7 +108,8 @@ int mutt_compose_attachment (BODY *a)
if (mutt_yesorno (_("Can't match nametemplate, continue?"), M_YES) != M_YES)
goto bailout;
}
- unlink_newfile = 1;
+ else
+ unlink_newfile = 1;
}
else
strfcpy(newfile, a->filename, sizeof(newfile));
@@ -173,7 +174,11 @@ int mutt_compose_attachment (BODY *a)
fclose (fp);
fclose (tfp);
mutt_unlink (a->filename);
- mutt_rename_file (tempfile, a->filename);
+ if (mutt_rename_file (tempfile, a->filename) != 0)
+ {
+ mutt_perror _("Failure to rename file.");
+ goto bailout;
+ }
mutt_free_body (&b);
}
@@ -235,7 +240,8 @@ int mutt_edit_attachment (BODY *a)
if (mutt_yesorno (_("Can't match nametemplate, continue?"), M_YES) != M_YES)
goto bailout;
}
- unlink_newfile = 1;
+ else
+ unlink_newfile = 1;
}
else
strfcpy(newfile, a->filename, sizeof(newfile));
@@ -607,6 +613,7 @@ int mutt_view_attachment (FILE *fp, BODY *a, int flag, HEADER *hdr,
rc = mutt_do_pager (descrip, pagerfile,
M_PAGER_ATTACHMENT | (is_message ? M_PAGER_MESSAGE : 0), &info);
+ *pagerfile = '\0';
}
else
rc = 0;