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

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


details:   http://hg.dovecot.org/dovecot-1.2/rev/570927dfc769
changeset: 8502:570927dfc769
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Nov 30 04:03:20 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 3fe1fb4e4f11 -r 570927dfc769 src/lib-storage/index/mbox/mbox-lock.c
--- a/src/lib-storage/index/mbox/mbox-lock.c	Sun Nov 30 02:45:12 2008 +0200
+++ b/src/lib-storage/index/mbox/mbox-lock.c	Sun Nov 30 04:03:20 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 3fe1fb4e4f11 -r 570927dfc769 src/lib-storage/index/mbox/mbox-sync.c
--- a/src/lib-storage/index/mbox/mbox-sync.c	Sun Nov 30 02:45:12 2008 +0200
+++ b/src/lib-storage/index/mbox/mbox-sync.c	Sun Nov 30 04:03:20 2008 +0200
@@ -1585,11 +1585,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