From 04a0df2514506f6c0691dbf848c063069f665fd2 Mon Sep 17 00:00:00 2001 From: peter Date: Tue, 4 Aug 1998 13:46:46 +0000 Subject: Invert the sense of the -s flag (local addition). Instead of compiling in the behavior via the previously default #define DONT_FSYNC, use the -s flag to turn the fsync() behavior on. This can be configured in sendmail.cf without recompiling mail.local. --- contrib/sendmail/mail.local/mail.local.8 | 5 +++-- contrib/sendmail/mail.local/mail.local.c | 22 +++++++++++----------- 2 files changed, 14 insertions(+), 13 deletions(-) (limited to 'contrib/sendmail') diff --git a/contrib/sendmail/mail.local/mail.local.8 b/contrib/sendmail/mail.local/mail.local.8 index 7aa7cdb..3bc0a77 100644 --- a/contrib/sendmail/mail.local/mail.local.8 +++ b/contrib/sendmail/mail.local/mail.local.8 @@ -40,11 +40,12 @@ Turn off the attempts to notify the .Dq biff service. .It Fl s -Turn off the +Turn on the .Xr fsync 2 call that forces the mailbox to be committed to disk before returning a .Dq success -status. +status. (This can configured in the flags passed through from +.Xr sendmail 8 ). .El .Pp Individual mail messages in the mailbox are delimited by an empty diff --git a/contrib/sendmail/mail.local/mail.local.c b/contrib/sendmail/mail.local/mail.local.c index 2a3b072..09a66c4 100644 --- a/contrib/sendmail/mail.local/mail.local.c +++ b/contrib/sendmail/mail.local/mail.local.c @@ -239,7 +239,7 @@ main(argc, argv) char *argv[]; { struct passwd *pw; - int ch, fd, nobiff, nofsync; + int ch, fd, nobiff, dofsync; uid_t uid; char *from; extern char *optarg; @@ -260,7 +260,7 @@ main(argc, argv) from = NULL; nobiff = 0; - nofsync = 0; + dofsync = 0; while ((ch = getopt(argc, argv, "bdf:r:ls")) != -1) switch(ch) { case 'b': @@ -280,7 +280,7 @@ main(argc, argv) lmtpmode++; break; case 's': - nofsync++; + dofsync++; break; case '?': default: @@ -290,7 +290,7 @@ main(argc, argv) argv += optind; if (lmtpmode) - dolmtp(nobiff, nofsync); + dolmtp(nobiff, dofsync); if (!*argv) usage(); @@ -315,7 +315,7 @@ main(argc, argv) * at the expense of repeated failures and multiple deliveries. */ for (fd = store(from, 0); *argv; ++argv) - deliver(fd, *argv, nobiff, nofsync); + deliver(fd, *argv, nobiff, dofsync); exit(eval); } @@ -431,8 +431,8 @@ process_recipient(addr) #define RCPT_GROW 30 void -dolmtp(nobiff, nofsync) - int nobiff, nofsync; +dolmtp(nobiff, dofsync) + int nobiff, dofsync; { char *return_path = NULL; char **rcpt_addr = NULL; @@ -477,7 +477,7 @@ dolmtp(nobiff, nofsync) if (p != NULL) *p++ = '\0'; deliver(msgfd, rcpt_addr[i], nobiff, - nofsync); + dofsync); } close(msgfd); goto rset; @@ -680,10 +680,10 @@ store(from, lmtprcpts) } void -deliver(fd, name, nobiff, nofsync) +deliver(fd, name, nobiff, dofsync) int fd; char *name; - int nobiff, nofsync; + int nobiff, dofsync; { struct stat fsb, sb; struct passwd *pw; @@ -851,7 +851,7 @@ tryagain: } /* Flush to disk, don't wait for update. */ - if (!nofsync && fsync(mbfd)) { + if (dofsync && fsync(mbfd)) { mailerr("450 4.2.0", "%s: %s", path, strerror(errno)); err3: if (setreuid(0, 0) < 0) { -- cgit v1.1