diff options
author | Andrey A. Chernov <ache@FreeBSD.org> | 1995-10-31 08:22:13 +0000 |
---|---|---|
committer | Andrey A. Chernov <ache@FreeBSD.org> | 1995-10-31 08:22:13 +0000 |
commit | e3807a3f8feccc9ddb8d8f239fdde6c9209063de (patch) | |
tree | 36d00b6fd89095b8c6ca4665861dc8a130a575cd /libexec/mail.local | |
parent | f4567b9c1ccaaaa45488055d09a81633c62244ff (diff) | |
download | src-e3807a3f8feccc9ddb8d8f239fdde6c9209063de.tar.gz src-e3807a3f8feccc9ddb8d8f239fdde6c9209063de.zip |
Put fsync under #ifdef EXTRA_SANITY and turn it off by default.
fsync here cause real disk trashing when large UUCP mail chanks
parsed.
Notes
Notes:
svn path=/head/; revision=11950
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 2f22012480f4..ea539a67d348 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 6effa031b227..d7b43a607f34 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)) { |