summaryrefslogtreecommitdiffstats
path: root/attach.c
diff options
context:
space:
mode:
authorBrendan Cully <brendan@kublai.com>2007-03-02 21:12:33 -0800
committerBrendan Cully <brendan@kublai.com>2007-03-02 21:12:33 -0800
commit262b2b63b9936f6d7d71ee6ced62e857a64a9606 (patch)
tree2706001c805cbc9188255fa3963041444f1d5db6 /attach.c
parent3e680e6ca4a04391ec3434ccb1b7f91675f0e336 (diff)
Add $umask for mailboxes and attachments.
init.c could really use some refactoring.
Diffstat (limited to 'attach.c')
-rw-r--r--attach.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/attach.c b/attach.c
index 8c3edf2e..609525d7 100644
--- a/attach.c
+++ b/attach.c
@@ -736,12 +736,21 @@ bail:
static FILE *
mutt_save_attachment_open (char *path, int flags)
{
+ mode_t omask;
+ FILE *fp = NULL;
+
+ omask = umask(Umask);
+
if (flags == M_SAVE_APPEND)
- return fopen (path, "a");
- if (flags == M_SAVE_OVERWRITE)
- return fopen (path, "w"); /* __FOPEN_CHECKED__ */
-
- return safe_fopen (path, "w");
+ fp = fopen (path, "a");
+ else if (flags == M_SAVE_OVERWRITE)
+ fp = fopen (path, "w"); /* __FOPEN_CHECKED__ */
+ else
+ fp = safe_fopen (path, "w");
+
+ umask(omask);
+
+ return fp;
}
/* returns 0 on success, -1 on error */