]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
dbox: Use mail's transaction view instead of mailbox's view whenever possible.
authorTimo Sirainen <tss@iki.fi>
Fri, 19 Mar 2010 13:19:49 +0000 (15:19 +0200)
committerTimo Sirainen <tss@iki.fi>
Fri, 19 Mar 2010 13:19:49 +0000 (15:19 +0200)
This fixes crash when saving/copying fails.

--HG--
branch : HEAD

src/lib-storage/index/dbox-multi/mdbox-mail.c
src/lib-storage/index/dbox-multi/mdbox-save.c
src/lib-storage/index/dbox-single/sdbox-mail.c

index 6ed52fd7d89af325f447b44ed2b6f61d955b2a29..2598a350d15e2eb7e36b914159b333166fdb75c2 100644 (file)
@@ -62,7 +62,7 @@ static void dbox_mail_set_expunged(struct dbox_mail *mail, uint32_t map_uid)
        struct mdbox_mailbox *mbox = (struct mdbox_mailbox *)_mail->box;
 
        (void)mail_index_refresh(_mail->box->index);
-       if (mail_index_is_expunged(_mail->box->view, _mail->seq)) {
+       if (mail_index_is_expunged(_mail->transaction->view, _mail->seq)) {
                mail_set_expunged(_mail);
                return;
        }
@@ -114,7 +114,7 @@ int mdbox_mail_open(struct dbox_mail *mail, uoff_t *offset_r,
                if (mail->open_file != NULL) {
                        /* already open */
                } else if (_mail->uid != 0) {
-                       if (mdbox_mail_lookup(mbox, _mail->box->view,
+                       if (mdbox_mail_lookup(mbox, _mail->transaction->view,
                                              _mail->seq, &map_uid) < 0)
                                return -1;
                        if (dbox_mail_open_init(mail, map_uid) < 0)
@@ -160,7 +160,7 @@ static int mdbox_mail_get_save_date(struct mail *mail, time_t *date_r)
        const void *data;
        bool expunged;
 
-       mail_index_lookup_ext(mail->box->view, mail->seq,
+       mail_index_lookup_ext(mail->transaction->view, mail->seq,
                              mbox->ext_id, &data, &expunged);
        dbox_rec = data;
        if (dbox_rec == NULL || dbox_rec->map_uid == 0) {
index 712eee9d78033f4217410ae045424a6ac04a9e5c..73fed84a1177878c42ee5ff7dc0de7582bdef06c 100644 (file)
@@ -368,7 +368,7 @@ int mdbox_copy(struct mail_save_context *_ctx, struct mail *mail)
 
        memset(&rec, 0, sizeof(rec));
        rec.save_date = ioloop_time;
-       if (mdbox_mail_lookup(src_mbox, mail->box->view, mail->seq,
+       if (mdbox_mail_lookup(src_mbox, mail->transaction->view, mail->seq,
                              &rec.map_uid) < 0)
                return -1;
 
@@ -382,7 +382,7 @@ int mdbox_copy(struct mail_save_context *_ctx, struct mail *mail)
        mail_index_update_ext(ctx->ctx.trans, ctx->ctx.seq,
                              ctx->mbox->ext_id, &rec, NULL);
 
-       mail_index_lookup_ext(mail->box->view, mail->seq,
+       mail_index_lookup_ext(mail->transaction->view, mail->seq,
                              src_mbox->guid_ext_id, &data, &expunged);
        if (data != NULL) {
                mail_index_update_ext(ctx->ctx.trans, ctx->ctx.seq,
index 01468fe014612fadd8c7cfc1cb8ceb8cea40f23f..77c55bd52592f03b3e002d2d147c62999afdc9ea 100644 (file)
@@ -18,7 +18,7 @@ static void sdbox_mail_set_expunged(struct dbox_mail *mail)
        struct sdbox_mailbox *mbox = (struct sdbox_mailbox *)_mail->box;
 
        (void)mail_index_refresh(_mail->box->index);
-       if (mail_index_is_expunged(_mail->box->view, _mail->seq)) {
+       if (mail_index_is_expunged(_mail->transaction->view, _mail->seq)) {
                mail_set_expunged(_mail);
                return;
        }