diff options
Diffstat (limited to 'libexec/mail.local')
-rw-r--r-- | libexec/mail.local/Makefile | 1 | ||||
-rw-r--r-- | libexec/mail.local/mail.local.c | 12 |
2 files changed, 8 insertions, 5 deletions
diff --git a/libexec/mail.local/Makefile b/libexec/mail.local/Makefile index 2f22012..ea539a6 100644 --- a/libexec/mail.local/Makefile +++ b/libexec/mail.local/Makefile @@ -2,6 +2,7 @@ PROG= mail.local MAN8= mail.local.8 +# CFLAGS+= -DEXTRA_SAFETY BINOWN= root BINMODE=4555 INSTALLFLAGS=-fschg diff --git a/libexec/mail.local/mail.local.c b/libexec/mail.local/mail.local.c index 6effa03..d7b43a6 100644 --- a/libexec/mail.local/mail.local.c +++ b/libexec/mail.local/mail.local.c @@ -288,22 +288,24 @@ tryagain: if ((nw = write(mbfd, buf + off, nr)) < 0) { e_to_sys(errno); warn("%s: %s", path, strerror(errno)); - goto err2;; + goto err2; } if (nr < 0) { e_to_sys(errno); warn("temporary file: %s", strerror(errno)); - goto err2;; +err2: (void)ftruncate(mbfd, curoff); +err1: (void)close(mbfd); + return; } +#ifdef EXTRA_SAFETY /* Flush to disk, don't wait for update. */ if (fsync(mbfd)) { e_to_sys(errno); warn("%s: %s", path, strerror(errno)); -err2: (void)ftruncate(mbfd, curoff); -err1: (void)close(mbfd); - return; + goto err2; } +#endif /* Close and check -- NFS doesn't write until the close. */ if (close(mbfd)) { |