]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
mdbox: Don't crash when rebuilding index if there's no alt storage dir.
authorTimo Sirainen <tss@iki.fi>
Fri, 19 Mar 2010 13:15:43 +0000 (15:15 +0200)
committerTimo Sirainen <tss@iki.fi>
Fri, 19 Mar 2010 13:15:43 +0000 (15:15 +0200)
--HG--
branch : HEAD

src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c

index a274f163760200653a096fcb547268e0816b44ac..75c7b7d8f496da3c5d1374e93e0defe4a3305e0f 100644 (file)
@@ -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)