changeset 10949:de26a4054910 HEAD

mdbox: Storage rebuild panics now earlier if its namespace unexpectedly isn't found.
author Timo Sirainen <tss@iki.fi>
date Fri, 19 Mar 2010 15:34:39 +0200
parents ae9d00b1ffdd
children 566360ae12fc
files src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c	Fri Mar 19 15:19:49 2010 +0200
+++ b/src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c	Fri Mar 19 15:34:39 2010 +0200
@@ -522,16 +522,17 @@
 
 static int rebuild_mailboxes(struct mdbox_storage_rebuild_context *ctx)
 {
-	struct mail_user *user = ctx->storage->storage.storage.user;
+	struct mail_storage *storage = &ctx->storage->storage.storage;
 	struct mail_namespace *ns;
 
-	for (ns = user->namespaces; ns != NULL; ns = ns->next) {
-		if (ns->storage == &ctx->storage->storage.storage &&
-		    ns->alias_for == NULL) {
+	for (ns = storage->user->namespaces; ns != NULL; ns = ns->next) {
+		if (ns->storage == storage && ns->alias_for == NULL) {
 			if (rebuild_namespace_mailboxes(ctx, ns) < 0)
 				return -1;
 		}
 	}
+	if (ctx->default_list == NULL)
+		i_panic("No namespace found for storage=%s", storage->name);
 	return 0;
 }