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

dovecot at dovecot.org dovecot at dovecot.org
Fri Dec 16 13:12:09 EET 2011


details:   http://hg.dovecot.org/dovecot-2.0/rev/4ea24cabfd88
changeset: 13001:4ea24cabfd88
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Dec 16 13:12:04 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 75daa638281b -r 4ea24cabfd88 src/lib-storage/index/index-storage.c
--- a/src/lib-storage/index/index-storage.c	Sat Dec 10 07:57:16 2011 +0200
+++ b/src/lib-storage/index/index-storage.c	Fri Dec 16 13:12:04 2011 +0200
@@ -434,6 +434,7 @@
 int index_storage_mailbox_delete(struct mailbox *box)
 {
 	uint8_t mailbox_guid[MAIL_GUID_128_SIZE];
+	enum mail_error error;
 
 	if (!box->opened) {
 		/* \noselect mailbox, try deleting only the directory */
@@ -460,7 +461,14 @@
 
 	mailbox_list_add_change(box->list, MAILBOX_LOG_RECORD_DELETE_MAILBOX,
 				mailbox_guid);
-	return index_storage_mailbox_delete_dir(box, TRUE);
+	if (index_storage_mailbox_delete_dir(box, TRUE) < 0) {
+		(void)mail_storage_get_last_error(box->storage, &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