diff options
author | Leah Neukirchen <leah@vuxu.org> | 2018-12-19 16:13:48 +0100 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2018-12-19 16:13:48 +0100 |
commit | 0da4342b220c8ed2108a332a2a9703c80fbcc2ea (patch) | |
tree | 9971ed03344c17c9db2490f39d43355a8443fec8 /mdeliver.c | |
parent | ab80765c2424f2445e2ba1b0740f266cbe218850 (diff) | |
download | mblaze-0da4342b220c8ed2108a332a2a9703c80fbcc2ea.tar.gz mblaze-0da4342b220c8ed2108a332a2a9703c80fbcc2ea.tar.xz mblaze-0da4342b220c8ed2108a332a2a9703c80fbcc2ea.zip |
mdeliver: keep permissions of message for freshly created files
Diffstat (limited to 'mdeliver.c')
-rw-r--r-- | mdeliver.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/mdeliver.c b/mdeliver.c index e53e5e2..41d1e01 100644 --- a/mdeliver.c +++ b/mdeliver.c @@ -1,3 +1,4 @@ +#include <sys/stat.h> #include <sys/time.h> #include <sys/types.h> @@ -84,7 +85,11 @@ tryagain: snprintf(tmp, sizeof tmp, "%s/tmp/%s", targetdir, id); - outfd = open(tmp, O_CREAT | O_WRONLY | O_EXCL, 0666); + struct stat st; + if (fstat(fileno(infile), &st) < 0) + st.st_mode = 0600; + outfd = open(tmp, O_CREAT | O_WRONLY | O_EXCL, + st.st_mode & 07777); if (outfd < 0) { if (errno == EEXIST) goto tryagain; |