In a system under heavy load, using the auto-creation facility of
deliverquota, I was finding that occasionally mailboxes were getting
partially created (/tmp existed but /new and /cur did not). Once in this
state, all subsequent deliveries failed, because the message could be
created under /tmp but not moved to /new. It required manual intervention to
create the other two subdirectories.
The attached patch should fix this, by the simple expedient of creating /tmp
last. If for some reason deliverquota dies part way through creating a
mailbox, it should be completed on the next delivery attempt.
Regards,
Brian Candler.
--- maildir/maildirmkdir.c.orig Tue Mar 5 15:36:38 2002
+++ maildir/maildirmkdir.c Tue Mar 5 15:38:44 2002
@@ -37,7 +37,7 @@
return (-1);
}
strcpy(buf, dir);
- strcpy(buf+l, "/tmp");
+ strcpy(buf+l, "/cur");
/* We do mkdir -p here */
@@ -62,7 +62,12 @@
free(buf);
return (-1);
}
- strcpy(buf+l, "/cur");
+ /*
+ * make /tmp last because this is the one we open first -
+ * the existence of this directory implies the whole
+ * Maildir structure is complete
+ */
+ strcpy(buf+l, "/tmp");
if (mkdir(buf, 0700) < 0 && errno != EEXIST) {
free(buf);
return (-1);