diff options
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/mail/quit.c | 3 | ||||
-rw-r--r-- | usr.bin/mail/v7.local.c | 5 |
2 files changed, 6 insertions, 2 deletions
diff --git a/usr.bin/mail/quit.c b/usr.bin/mail/quit.c index a960755..4b9bcda 100644 --- a/usr.bin/mail/quit.c +++ b/usr.bin/mail/quit.c @@ -228,7 +228,8 @@ quit(void) return; } (void)Fclose(obuf); - (void)close(open(mbox, O_CREAT | O_TRUNC | O_WRONLY, 0600)); + if ((fd = open(mbox, O_CREAT | O_TRUNC | O_WRONLY, 0600)) >= 0) + (void)close(fd); if ((obuf = Fopen(mbox, "r+")) == NULL) { warn("%s", mbox); (void)Fclose(ibuf); diff --git a/usr.bin/mail/v7.local.c b/usr.bin/mail/v7.local.c index 8fc2f64..0da7b3b 100644 --- a/usr.bin/mail/v7.local.c +++ b/usr.bin/mail/v7.local.c @@ -68,9 +68,12 @@ findmail(char *user, char *buf, int buflen) void demail(void) { + int fd; if (value("keep") != NULL || rm(mailname) < 0) - (void)close(open(mailname, O_CREAT | O_TRUNC | O_WRONLY, 0600)); + if ((fd = open(mailname, O_CREAT | O_TRUNC | O_WRONLY, 0600)) >= + 0) + (void)close(fd); } /* |