dovecot-2.1: FS layout: When deleting a mailbox, don't give an e...

dovecot at dovecot.org dovecot at dovecot.org
Fri Dec 16 13:08:49 EET 2011


details:   http://hg.dovecot.org/dovecot-2.1/rev/6ded89937e98
changeset: 13867:6ded89937e98
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Dec 16 13:08:18 2011 +0200
description:
FS layout: When deleting a mailbox, don't give an error if mailbox has children.
The mailbox got successfully deleted, but it still gave an error.

diffstat:

 src/lib-storage/index/index-storage.c |  10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diffs (27 lines):

diff -r c682a5bf3de7 -r 6ded89937e98 src/lib-storage/index/index-storage.c
--- a/src/lib-storage/index/index-storage.c	Fri Dec 16 12:50:53 2011 +0200
+++ b/src/lib-storage/index/index-storage.c	Fri Dec 16 13:08:18 2011 +0200
@@ -511,6 +511,7 @@
 {
 	struct mailbox_metadata metadata;
 	struct mailbox_status status;
+	enum mail_error error;
 	int ret_guid;
 
 	if (!box->opened) {
@@ -564,7 +565,14 @@
 					MAILBOX_LOG_RECORD_DELETE_MAILBOX,
 					metadata.guid);
 	}
-	return index_storage_mailbox_delete_dir(box, TRUE);
+	if (index_storage_mailbox_delete_dir(box, TRUE) < 0) {
+		(void)mailbox_get_last_error(box, &error);
+		if (error != MAIL_ERROR_EXISTS)
+			return -1;
+		/* we deleted the mailbox, but couldn't delete the directory
+		   because it has children. that's not an error. */
+	}
+	return 0;
 }
 
 int index_storage_mailbox_rename(struct mailbox *src, struct mailbox *dest,


More information about the dovecot-cvs mailing list