From: Timo Sirainen Date: Fri, 19 Mar 2010 13:15:43 +0000 (+0200) Subject: mdbox: Don't crash when rebuilding index if there's no alt storage dir. X-Git-Tag: 2.0.beta4~21 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0043c3c8b4636255d105eab36e12ed7dfa9f03c6;p=thirdparty%2Fdovecot%2Fcore.git mdbox: Don't crash when rebuilding index if there's no alt storage dir. --HG-- branch : HEAD --- diff --git a/src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c b/src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c index a274f16376..75c7b7d8f4 100644 --- a/src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c +++ b/src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c @@ -817,12 +817,13 @@ static int mdbox_storage_rebuild_scan(struct mdbox_storage_rebuild_context *ctx) if (mdbox_storage_rebuild_scan_dir(ctx, ctx->storage->storage_dir, FALSE) < 0) return -1; - if (mdbox_storage_rebuild_scan_dir(ctx, ctx->storage->alt_storage_dir, - TRUE) < 0) - return -1; + if (ctx->storage->alt_storage_dir != NULL) { + if (mdbox_storage_rebuild_scan_dir(ctx, + ctx->storage->alt_storage_dir, TRUE) < 0) + return -1; + } - if (ret < 0 || - rebuild_apply_map(ctx) < 0 || + if (rebuild_apply_map(ctx) < 0 || rebuild_mailboxes(ctx) < 0 || rebuild_finish(ctx) < 0 || mail_index_sync_commit(&ctx->sync_ctx) < 0)