*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
- /* good file descriptor */
- break;
+ if ((fd = lkopenspool (file, O_RDWR | O_CREAT | O_NONBLOCK,
+ mode, &failed_to_lock)) != NOTOK)
+ break;
+
+ if (!failed_to_lock)
+ return NOTOK;
+
+ j = errno;
+ sleep (5);
- while ((i = read (fd, buffer, sizeof(buffer))) > 0) {
- /* valgrind noticed that stringdex depends on null
- termination. */
- buffer[i] = '\0';
+ while ((i = read (fd, buffer, sizeof buffer - 1)) > 0) {
+ buffer[i] = '\0'; /* Terminate for stringdex(). */
- if (HasPrefix(buffer, "Return-Path:")) {
- char tmpbuffer[BUFSIZ];
+ if (has_prefix(buffer, "Return-Path:")) {
+ char tmpbuffer[sizeof buffer];
tp = dctime(dlocaltimenow());
snprintf (buffer, sizeof(buffer), "From %.*s %s",
(int)(fp - ep), ep, tp);
tp = dctime(dlocaltimenow());
snprintf (buffer, sizeof(buffer), "From %.*s %s",
(int)(fp - ep), ep, tp);
char *ep;
strncpy(tmpbuffer, buffer, sizeof(tmpbuffer));
ep = tmpbuffer + 17;
snprintf (buffer, sizeof(buffer), "From %s", ep);
char *ep;
strncpy(tmpbuffer, buffer, sizeof(tmpbuffer));
ep = tmpbuffer + 17;
snprintf (buffer, sizeof(buffer), "From %s", ep);
/*
* If there is already a "From " line,
* then leave it alone. Else we add one.
*/
/*
* If there is already a "From " line,
* then leave it alone. Else we add one.
*/
* If this is not first line, and begins with
* "From ", then prepend line with ">".
*/
* If this is not first line, and begins with
* "From ", then prepend line with ">".
*/
if (write (md, ">", 1) < 0) {
advise (mailbox, "write");
}
if (write (md, ">", 1) < 0) {
advise (mailbox, "write");
}
- admonish (NULL, "%s: version mismatch (%d != %d)", file,
+ inform("%s: version mismatch (%d != %d), continuing...", file,
- admonish (NULL,
- "%s: pointer mismatch or incomplete index (%ld!=%ld)",
- file, dp->d_stop, (long) pos);
+ inform("%s: pointer mismatch or incomplete index (%ld!=%ld), "
+ "continuing...", file, dp->d_stop, (long) pos);