]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
mdbox: Error handling fixes.
authorTimo Sirainen <tss@iki.fi>
Thu, 1 Jul 2010 15:28:15 +0000 (16:28 +0100)
committerTimo Sirainen <tss@iki.fi>
Thu, 1 Jul 2010 15:28:15 +0000 (16:28 +0100)
--HG--
branch : HEAD

src/lib-storage/index/dbox-multi/mdbox-map.c
src/lib-storage/index/dbox-multi/mdbox-save.c

index 85544b6d2b3ae12630f4995fec30005999155c5f..3141b60de7799d8fbb68a1bf84e274baf1061f95 100644 (file)
@@ -481,13 +481,16 @@ int mdbox_map_atomic_finish(struct mdbox_map_atomic_context **_atomic)
 
        *_atomic = NULL;
 
-       if (atomic->success) {
+       if (atomic->sync_ctx == NULL) {
+               /* not locked */
+               i_assert(!atomic->locked);
+       } else if (atomic->success) {
                if (mail_index_sync_commit(&atomic->sync_ctx) < 0) {
                        mail_storage_set_internal_error(MAP_STORAGE(atomic->map));
                        mail_index_reset_error(atomic->map->index);
                        ret = -1;
                }
-       } else if (atomic->sync_ctx != NULL) {
+       } else {
                mail_index_sync_rollback(&atomic->sync_ctx);
        }
        i_free(atomic);
index 7ad581362f0a76dce5300621210675462ee6fa87..0eeea38d2aaee5940ed7579d0ef6c0f46afd0957 100644 (file)
@@ -141,6 +141,8 @@ int mdbox_save_begin(struct mail_save_context *_ctx, struct istream *input)
        if (mdbox_map_append_next(ctx->append_ctx, mail_size, 0,
                                  &ctx->cur_file_append,
                                  &ctx->ctx.dbox_output) < 0) {
+               ctx->cur_file_append = NULL;
+               ctx->ctx.dbox_output = NULL;
                ctx->ctx.failed = TRUE;
                return -1;
        }