]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
dbox: Don't assert-crash if trying to read a mail that's being saved.
authorTimo Sirainen <tss@iki.fi>
Mon, 8 Mar 2010 17:39:43 +0000 (19:39 +0200)
committerTimo Sirainen <tss@iki.fi>
Mon, 8 Mar 2010 17:39:43 +0000 (19:39 +0200)
--HG--
branch : HEAD

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

index 5390bd5a2726a36a7460b647622d2c2ee0ffe703..01468fe014612fadd8c7cfc1cb8ceb8cea40f23f 100644 (file)
@@ -32,6 +32,8 @@ static bool sdbox_mail_file_set(struct dbox_mail *mail)
 {
        struct mail *_mail = &mail->imail.mail.mail;
        struct sdbox_mailbox *mbox = (struct sdbox_mailbox *)_mail->box;
+       bool deleted;
+       int ret;
 
        if (mail->open_file != NULL) {
                /* already set */
@@ -45,6 +47,10 @@ static bool sdbox_mail_file_set(struct dbox_mail *mail)
                        sdbox_save_file_get_file(_mail->transaction,
                                                 _mail->seq);
                mail->open_file->refcount++;
+
+               /* it doesn't have input stream yet */
+               ret = dbox_file_open(mail->open_file, &deleted);
+               i_assert(ret > 0);
                return TRUE;
        }
 }