]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Make sure istream-mail doesn't replace an existing storage error
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 5 Jun 2017 17:14:54 +0000 (20:14 +0300)
committerGitLab <gitlab@git.dovecot.net>
Mon, 5 Jun 2017 20:37:49 +0000 (23:37 +0300)
I'm not aware of it actually having broken anything, so this is just for
extra safety.

src/lib-storage/index/istream-mail.c

index a5bfcfbda5e4367feef7d1cdcdcc14c7c79bce1c..bc57500150d52ae1f323eefd689708d07cf80908 100644 (file)
@@ -23,11 +23,15 @@ static bool i_stream_mail_try_get_cached_size(struct mail_istream *mstream)
        if (mstream->expected_size != (uoff_t)-1)
                return TRUE;
 
+       /* make sure this call doesn't change any existing error message,
+          just in case there's already something important in it. */
+       mail_storage_last_error_push(mail->box->storage);
        orig_lookup_abort = mail->lookup_abort;
        mail->lookup_abort = MAIL_LOOKUP_ABORT_NOT_IN_CACHE;
        if (mail_get_physical_size(mail, &mstream->expected_size) < 0)
                mstream->expected_size = (uoff_t)-1;
        mail->lookup_abort = orig_lookup_abort;
+       mail_storage_last_error_pop(mail->box->storage);
        return mstream->expected_size != (uoff_t)-1;
 }