diff options
author | ache <ache@FreeBSD.org> | 1995-10-31 08:22:13 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1995-10-31 08:22:13 +0000 |
commit | f84f405c033ddf0b31d0ae5dd21ca4bf85821c13 (patch) | |
tree | 36d00b6fd89095b8c6ca4665861dc8a130a575cd | |
parent | 21d9ef842e824232e230b047c60d4c49fbe6c381 (diff) | |
download | FreeBSD-src-f84f405c033ddf0b31d0ae5dd21ca4bf85821c13.zip FreeBSD-src-f84f405c033ddf0b31d0ae5dd21ca4bf85821c13.tar.gz |
Put fsync under #ifdef EXTRA_SANITY and turn it off by default.
fsync here cause real disk trashing when large UUCP mail chanks
parsed.
-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)) { |