dovecot-1.1: Fixed "Cached message offset lost" errors when quot...
dovecot at dovecot.org
dovecot at dovecot.org
Sun Feb 17 14:29:59 EET 2008
details: http://hg.dovecot.org/dovecot-1.1/rev/36da161ecc66
changeset: 7265:36da161ecc66
user: Timo Sirainen <tss at iki.fi>
date: Sun Feb 17 14:30:39 2008 +0200
description:
Fixed "Cached message offset lost" errors when quota plugin was used.
diffstat:
1 file changed, 13 insertions(+), 8 deletions(-)
src/lib-storage/index/mbox/mbox-mail.c | 21 +++++++++++++--------
diffs (31 lines):
diff -r 91cf91f0a0a8 -r 36da161ecc66 src/lib-storage/index/mbox/mbox-mail.c
--- a/src/lib-storage/index/mbox/mbox-mail.c Sun Feb 17 12:48:44 2008 +0200
+++ b/src/lib-storage/index/mbox/mbox-mail.c Sun Feb 17 14:30:39 2008 +0200
@@ -195,14 +195,19 @@ static int mbox_mail_get_physical_size(s
/* use the next message's offset to avoid reading through the entire
message body to find out its size */
hdr = mail_index_get_header(mail->trans->trans_view);
- if (_mail->seq == hdr->messages_count) {
- /* last message, use the synced mbox size */
- int trailer_size;
-
- trailer_size = (mbox->storage->storage.flags &
- MAIL_STORAGE_FLAG_SAVE_CRLF) != 0 ? 2 : 1;
-
- body_size = hdr->sync_size - body_offset - trailer_size;
+ if (_mail->seq >= hdr->messages_count) {
+ if (_mail->seq == hdr->messages_count) {
+ /* last message, use the synced mbox size */
+ int trailer_size;
+
+ trailer_size = (mbox->storage->storage.flags &
+ MAIL_STORAGE_FLAG_SAVE_CRLF) != 0 ?
+ 2 : 1;
+ body_size = hdr->sync_size - body_offset - trailer_size;
+ } else {
+ /* we're appending a new message */
+ body_size = (uoff_t)-1;
+ }
} else if (mbox_file_lookup_offset(mbox, mail->trans->trans_view,
_mail->seq + 1, &next_offset) > 0) {
body_size = next_offset - body_offset;
More information about the dovecot-cvs
mailing list