diff options
Diffstat (limited to 'usr.bin/mail/send.c')
-rw-r--r-- | usr.bin/mail/send.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/usr.bin/mail/send.c b/usr.bin/mail/send.c index 5be7405..a199323 100644 --- a/usr.bin/mail/send.c +++ b/usr.bin/mail/send.c @@ -59,7 +59,7 @@ sendmessage(struct message *mp, FILE *obuf, struct ignoretab *doign, FILE *ibuf; char *cp, *cp2, line[LINESIZE]; int ishead, infld, ignoring, dostat, firstline; - int c, length, prefixlen; + int c = 0, length, prefixlen; /* * Compute the prefix string, without trailing whitespace @@ -566,8 +566,13 @@ savemail(char name[], FILE *fi) char buf[BUFSIZ]; int i; time_t now; + mode_t saved_umask; - if ((fo = Fopen(name, "a")) == NULL) { + saved_umask = umask(077); + fo = Fopen(name, "a"); + umask(saved_umask); + + if (fo == NULL) { warn("%s", name); return (-1); } |