[dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-save.c, 1.94.2.13, 1.94.2.14
tss at dovecot.org
tss at dovecot.org
Thu Apr 26 21:30:17 EEST 2007
Update of /var/lib/cvs/dovecot/src/lib-storage/index/mbox
In directory talvi:/tmp/cvs-serv15453
Modified Files:
Tag: branch_1_0
mbox-save.c
Log Message:
If we synced the mbox while saving the message (happens only with quota
plugin loaded), we could have used a wrong append offset (calculated before
sync) which caused "Unexpectedly lost From-line" errors, and depending on
the sync either extra NUL lines or Content-Length header written over
existing mails (quite unlikely).
Index: mbox-save.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-save.c,v
retrieving revision 1.94.2.13
retrieving revision 1.94.2.14
diff -u -d -r1.94.2.13 -r1.94.2.14
--- mbox-save.c 26 Apr 2007 17:03:34 -0000 1.94.2.13
+++ mbox-save.c 26 Apr 2007 18:30:14 -0000 1.94.2.14
@@ -305,12 +305,6 @@
syncing. */
mbox_save_init_sync(t);
}
-
- if (mbox_seek_to_end(ctx, &ctx->append_offset) < 0)
- return -1;
-
- ctx->output = o_stream_create_file(mbox->mbox_fd, default_pool,
- 0, FALSE);
}
if (!ctx->synced && want_mail) {
@@ -320,6 +314,14 @@
mbox_save_init_sync(t);
}
+ /* the syncing above could have changed the append offset */
+ if (ctx->append_offset == (uoff_t)-1) {
+ if (mbox_seek_to_end(ctx, &ctx->append_offset) < 0)
+ return -1;
+
+ ctx->output = o_stream_create_file(mbox->mbox_fd, default_pool,
+ 0, FALSE);
+ }
return 0;
}
More information about the dovecot-cvs
mailing list