This patch saves attachments with a sane umask so that they're readable by
others. This makes it possible to save them to a directory on the world wide
web and view or download them by a browser.
---
attach.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/attach.c b/attach.c
index 0efeb79..c998e69 100644
--- a/attach.c
+++ b/attach.c
@@ -691,12 +691,16 @@ bail:
static FILE *
mutt_save_attachment_open (char *path, int flags)
{
+ mode_t omask = umask(022);
+ FILE *ret;
+
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");
+ ret = fopen (path, "a");
+ else
+ ret = fopen (path, "w");
+
+ umask(omask);
+ return ret;
}
/* returns 0 on success, -1 on error */
--
1.7.10.4