diff options
author | peter <peter@FreeBSD.org> | 1996-10-29 05:35:24 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1996-10-29 05:35:24 +0000 |
commit | 7bfbad34044e0a36f7cac3026863194bf3f1e5f0 (patch) | |
tree | 12b4892914323a812b2a6b1f84f3b00c76eab5d1 /usr.sbin/sendmail | |
parent | 6d127efe9f51e21d4976f4dd498851053c1628c3 (diff) | |
download | FreeBSD-src-7bfbad34044e0a36f7cac3026863194bf3f1e5f0.zip FreeBSD-src-7bfbad34044e0a36f7cac3026863194bf3f1e5f0.tar.gz |
Convert the DONT_FSYNC compile time option to a runtime option (like
nobiff). The options to turn these on are specified in the
LOCAL_MAILER_ARGS define the the sendmail.mc that you build from.
Diffstat (limited to 'usr.sbin/sendmail')
-rw-r--r-- | usr.sbin/sendmail/mail.local/Makefile | 3 | ||||
-rw-r--r-- | usr.sbin/sendmail/mail.local/mail.local.8 | 9 | ||||
-rw-r--r-- | usr.sbin/sendmail/mail.local/mail.local.c | 36 |
3 files changed, 27 insertions, 21 deletions
diff --git a/usr.sbin/sendmail/mail.local/Makefile b/usr.sbin/sendmail/mail.local/Makefile index 9e2217c..86579d7 100644 --- a/usr.sbin/sendmail/mail.local/Makefile +++ b/usr.sbin/sendmail/mail.local/Makefile @@ -2,9 +2,6 @@ PROG= mail.local MAN8= mail.local.8 -.if defined(DONT_FSYNC) -CFLAGS+= -DDONT_FSYNC -.endif BINOWN= root BINMODE=4555 INSTALLFLAGS=-fschg diff --git a/usr.sbin/sendmail/mail.local/mail.local.8 b/usr.sbin/sendmail/mail.local/mail.local.8 index 8ffd535..ba09de7 100644 --- a/usr.sbin/sendmail/mail.local/mail.local.8 +++ b/usr.sbin/sendmail/mail.local/mail.local.8 @@ -30,7 +30,7 @@ .\" SUCH DAMAGE. .\" .\" @(#)mail.local.8 8.2 (Berkeley) 12/11/93 -.\" $Id$ +.\" $Id: mail.local.8,v 1.2 1996/10/29 05:22:51 peter Exp $ .\" .Dd December 11, 1993 .Dt MAIL.LOCAL 8 @@ -42,6 +42,7 @@ .Nm mail.local .Op Fl f Ar from .Op Fl b +.Op Fl s .Ar user ... .Sh DESCRIPTION .Nm Mail.local @@ -61,6 +62,12 @@ Specify the sender's name. Turn off the attempts to notify the .Dq biff service. +.It Fl s +Turn off the +.Xr fsync 2 +call that forces the mailbox to be committed to disk before returning a +.Dq success +status. .El .Pp Individual mail messages in the mailbox are delimited by an empty diff --git a/usr.sbin/sendmail/mail.local/mail.local.c b/usr.sbin/sendmail/mail.local/mail.local.c index 1315836..ae320ee 100644 --- a/usr.sbin/sendmail/mail.local/mail.local.c +++ b/usr.sbin/sendmail/mail.local/mail.local.c @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: mail.local.c,v 1.2 1996/10/29 05:22:52 peter Exp $ */ #ifndef lint @@ -176,7 +176,7 @@ extern FILE *fdopen __P((int, const char *)); int eval = EX_OK; /* sysexits.h error value. */ -void deliver __P((int, char *, int)); +void deliver __P((int, char *, int, int)); void e_to_sys __P((int)); void err __P((const char *, ...)) __dead2; void notifybiff __P((char *)); @@ -193,7 +193,7 @@ main(argc, argv) char *argv[]; { struct passwd *pw; - int ch, fd, nobiff; + int ch, fd, nobiff, nofsync; uid_t uid; char *from; extern char *optarg; @@ -214,7 +214,8 @@ main(argc, argv) from = NULL; nobiff = 0; - while ((ch = getopt(argc, argv, "bdf:r:")) != EOF) + nofsync = 0; + while ((ch = getopt(argc, argv, "bdf:r:s")) != EOF) switch(ch) { case 'b': nobiff++; @@ -229,6 +230,9 @@ main(argc, argv) } from = optarg; break; + case 's': + nofsync++; + break; case '?': default: usage(); @@ -259,7 +263,7 @@ main(argc, argv) * at the expense of repeated failures and multiple deliveries. */ for (fd = store(from); *argv; ++argv) - deliver(fd, *argv, nobiff); + deliver(fd, *argv, nobiff, nofsync); exit(eval); } @@ -314,8 +318,8 @@ store(from) } void -deliver(fd, name, nobiff) - int fd, nobiff; +deliver(fd, name, nobiff, nofsync) + int fd, nobiff, nofsync; char *name; { struct stat fsb, sb; @@ -457,6 +461,13 @@ tryagain: if (nr < 0) { e_to_sys(errno); warn("temporary file: %s", strerror(errno)); + goto err3; + } + + /* Flush to disk, don't wait for update. */ + if (!nofsync && fsync(mbfd)) { + e_to_sys(errno); + warn("%s: %s", path, strerror(errno)); err3: if (setreuid(0, 0) < 0) { e_to_sys(errno); @@ -470,15 +481,6 @@ err1: (void)close(mbfd); err0: unlockmbox(); return; } - -#if !defined(DONT_FSYNC) - /* Flush to disk, don't wait for update. */ - if (fsync(mbfd)) { - e_to_sys(errno); - warn("%s: %s", path, strerror(errno)); - goto err3; - } -#endif /* Close and check -- NFS doesn't write until the close. */ if (close(mbfd)) { @@ -588,7 +590,7 @@ void usage() { eval = EX_USAGE; - err("usage: mail.local [-b] [-f from] user ..."); + err("usage: mail.local [-b] [-f from] [-s] user ..."); } #if __STDC__ |