dovecot-1.1: mbox: If mailbox is deleted under us, try to avoid ...

dovecot at dovecot.org dovecot at dovecot.org
Sun Nov 30 04:03:39 EET 2008


details:   http://hg.dovecot.org/dovecot-1.1/rev/e24a2528ce21
changeset: 8026:e24a2528ce21
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Nov 30 04:03:35 2008 +0200
description:
mbox: If mailbox is deleted under us, try to avoid logging errors.

diffstat:

2 files changed, 12 insertions(+), 1 deletion(-)
src/lib-storage/index/mbox/mbox-lock.c |    5 ++++-
src/lib-storage/index/mbox/mbox-sync.c |    8 ++++++++

diffs (38 lines):

diff -r e6ae9deb6082 -r e24a2528ce21 src/lib-storage/index/mbox/mbox-lock.c
--- a/src/lib-storage/index/mbox/mbox-lock.c	Mon Nov 24 00:36:00 2008 +0200
+++ b/src/lib-storage/index/mbox/mbox-lock.c	Sun Nov 30 04:03:35 2008 +0200
@@ -184,7 +184,10 @@ static int mbox_file_open_latest(struct 
 		   deleted and the flushing might cause errors (e.g. EBUSY for
 		   trying to flush a /var/mail mountpoint) */
 		if (nfs_safe_stat(mbox->path, &st) < 0) {
-			mbox_set_syscall_error(mbox, "stat()");
+			if (errno == ENOENT)
+				mailbox_set_deleted(&mbox->ibox.box);
+			else
+				mbox_set_syscall_error(mbox, "stat()");
 			return -1;
 		}
 
diff -r e6ae9deb6082 -r e24a2528ce21 src/lib-storage/index/mbox/mbox-sync.c
--- a/src/lib-storage/index/mbox/mbox-sync.c	Mon Nov 24 00:36:00 2008 +0200
+++ b/src/lib-storage/index/mbox/mbox-sync.c	Sun Nov 30 04:03:35 2008 +0200
@@ -1584,11 +1584,19 @@ int mbox_sync_has_changed_full(struct mb
 		/* read-only stream */
 		st = i_stream_stat(mbox->mbox_file_stream, FALSE);
 		if (st == NULL) {
+			if (errno == ENOENT) {
+				mailbox_set_deleted(&mbox->ibox.box);
+				return 0;
+			}
 			mbox_set_syscall_error(mbox, "i_stream_stat()");
 			return -1;
 		}
 	} else {
 		if (stat(mbox->path, &statbuf) < 0) {
+			if (errno == ENOENT) {
+				mailbox_set_deleted(&mbox->ibox.box);
+				return 0;
+			}
 			mbox_set_syscall_error(mbox, "stat()");
 			return -1;
 		}


More information about the dovecot-cvs mailing list