Sorry, it would probably be more useful if were to submit the correct patch!
-- Tim Marston ed.am
--- sendmail-8.14.4/build-tree/sendmail-8.14.4/mail.local/mail.local.c 2013-01-27 07:23:47.531568453 +0000 +++ new/sendmail-8.14.4/build-tree/sendmail-8.14.4/mail.local/mail.local.c 2013-01-27 06:51:30.791562351 +0000 @@ -1082,26 +1082,6 @@ */ tryagain: -#ifdef MAILLOCK - p = name; -#else /* MAILLOCK */ - p = path; -#endif /* MAILLOCK */ - if ((off = lockmbox(p)) != 0) - { - if (off == EX_TEMPFAIL || e_to_sys(off) == EX_TEMPFAIL) - { - ExitVal = EX_TEMPFAIL; - errcode = "451 4.3.0"; - } - else - errcode = "551 5.3.0"; - - mailerr(errcode, "lockmailbox %s failed; error code %d %s", - p, off, errno > 0 ? sm_errstring(errno) : ""); - return; - } - if (lstat(path, &sb) < 0) { int save_errno; @@ -1252,6 +1232,26 @@ goto err1; } +#ifdef MAILLOCK + p = name; +#else /* MAILLOCK */ + p = path; +#endif /* MAILLOCK */ + if ((off = lockmbox(p)) != 0) + { + if (off == EX_TEMPFAIL || e_to_sys(off) == EX_TEMPFAIL) + { + ExitVal = EX_TEMPFAIL; + errcode = "451 4.3.0"; + } + else + errcode = "551 5.3.0"; + + mailerr(errcode, "lockmailbox %s failed; error code %d %s", + p, off, errno > 0 ? sm_errstring(errno) : ""); + goto err1; + } + /* Get the starting offset of the new message */ curoff = lseek(mbfd, (off_t) 0, SEEK_END); (void) sm_snprintf(biffmsg, sizeof(biffmsg), "%s@%lld\n", @@ -1325,10 +1325,10 @@ #endif /* DEBUG */ if (mbfd >= 0) (void) ftruncate(mbfd, curoff); -err1: if (mbfd >= 0) +err1: unlockmbox(); + if (mbfd >= 0) (void) close(mbfd); err0: (void) setreuid(0, 0); - unlockmbox(); return; } @@ -1346,6 +1346,7 @@ else cursize = sb.st_size; + unlockmbox(); /* Close and check -- NFS doesn't write until the close. */ if (close(mbfd)) @@ -1395,7 +1396,6 @@ #ifdef DEBUG fprintf(stderr, "reset euid = %d\n", (int) geteuid()); #endif /* DEBUG */ - unlockmbox(); if (LMTPMode) printf("250 2.1.5 %s Ok\r\n", name); }