]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Set index error on transaction commit() callback
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 25 Dec 2017 16:18:14 +0000 (18:18 +0200)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Mon, 15 Jan 2018 09:43:03 +0000 (11:43 +0200)
The commit callback is setting errors to storage. However, it's being
called from mail_index_transaction_commit() whose callers are expecting
the error to be in index. If that index error was attempted to be used,
it could have been wrong or NULL. Fix this by setting the same storage
error also to the index.

src/lib-storage/index/index-transaction.c

index f9c710bef9a6941cdcbbc91b1de439d184d2f9fb..45085ec177eb489d9329ae9962af8f41a17784cc 100644 (file)
@@ -94,6 +94,8 @@ index_transaction_index_commit(struct mail_index_transaction *index_trans,
                index_mailbox_sync_pvt_deinit(&pvt_sync_ctx);
        }
 
+       if (ret < 0)
+               mail_index_set_error_nolog(t->box->index, mailbox_get_last_error(t->box, NULL));
        index_transaction_free(t);
        return ret;
 }