Put fsync under #ifdef EXTRA_SANITY and turn it off by default.

fsync here cause real disk trashing when large UUCP mail chanks
parsed.
This commit is contained in:
Andrey A. Chernov 1995-10-31 08:22:13 +00:00
parent f4567b9c1c
commit e3807a3f8f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=11950
2 changed files with 11 additions and 8 deletions

View File

@ -2,6 +2,7 @@
PROG= mail.local
MAN8= mail.local.8
# CFLAGS+= -DEXTRA_SAFETY
BINOWN= root
BINMODE=4555
INSTALLFLAGS=-fschg

View File

@ -288,23 +288,25 @@ deliver(fd, name)
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;;
}
/* 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;
}
#ifdef EXTRA_SAFETY
/* Flush to disk, don't wait for update. */
if (fsync(mbfd)) {
e_to_sys(errno);
warn("%s: %s", path, strerror(errno));
goto err2;
}
#endif
/* Close and check -- NFS doesn't write until the close. */
if (close(mbfd)) {
e_to_sys(errno);