Skip to content

Commit

Permalink
lib-storage: Make sure istream-mail doesn't replace an existing stora…
Browse files Browse the repository at this point in the history
…ge error

I'm not aware of it actually having broken anything, so this is just for
extra safety.
  • Loading branch information
sirainen authored and villesavolainen committed Jun 9, 2017
1 parent f02f204 commit f245094
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/lib-storage/index/istream-mail.c
Expand Up @@ -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;
}

Expand Down

0 comments on commit f245094

Please sign in to comment.