diff options
author | Thomas Roessler <roessler@does-not-exist.org> | 1999-02-28 08:05:54 +0000 |
---|---|---|
committer | Thomas Roessler <roessler@does-not-exist.org> | 1999-02-28 08:05:54 +0000 |
commit | ec42e01f8fe4623178a747c551dcfb3ebc5d397c (patch) | |
tree | 54045806fba79f5c6af27c909be7a01d4c38fd0c /attach.c | |
parent | ae40aac542aaa9c417ae8588433492520bda20a2 (diff) |
Fix a $TMPDIR race condition.
Diffstat (limited to 'attach.c')
-rw-r--r-- | attach.c | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -712,9 +712,11 @@ int mutt_save_attachment (FILE *fp, BODY *m, char *path, int flags, HEADER *hdr) memset (&s, 0, sizeof (s)); if (flags == M_SAVE_APPEND) - s.fpout = safe_fopen (path, "a"); - else + s.fpout = fopen (path, "a"); + else if (flags == M_SAVE_OVERWRITE) s.fpout = fopen (path, "w"); + else + s.fpout = safe_fopen (path, "w"); if (s.fpout == NULL) { mutt_perror ("fopen"); @@ -776,9 +778,12 @@ int mutt_decode_save_attachment (FILE *fp, BODY *m, char *path, s.flags = (displaying ? M_DISPLAY : 0); if (flags == M_SAVE_APPEND) - s.fpout = safe_fopen (path, "a"); - else + s.fpout = fopen (path, "a"); + else if (flags == M_SAVE_OVERWRITE) s.fpout = fopen (path, "w"); + else + s.fpout = safe_fopen (path, "w"); + if (s.fpout == NULL) { perror ("fopen"); |