dovecot-2.0-sslstream: mdbox saving: Fallback to using non-exact...
dovecot at dovecot.org
dovecot at dovecot.org
Sat Feb 13 03:00:49 EET 2010
details: http://hg.dovecot.org/dovecot-2.0-sslstream/rev/e9f4efacf692
changeset: 10651:e9f4efacf692
user: Timo Sirainen <tss at iki.fi>
date: Sat Feb 06 23:22:04 2010 +0200
description:
mdbox saving: Fallback to using non-exact mail size if exact isn't available.
The size is used only to check if it would make mdbox file become too large.
diffstat:
1 file changed, 10 insertions(+), 2 deletions(-)
src/lib-storage/index/dbox-multi/mdbox-save.c | 12 ++++++++++--
diffs (22 lines):
diff -r cfe7d639fa03 -r e9f4efacf692 src/lib-storage/index/dbox-multi/mdbox-save.c
--- a/src/lib-storage/index/dbox-multi/mdbox-save.c Sat Feb 06 21:07:44 2010 +0200
+++ b/src/lib-storage/index/dbox-multi/mdbox-save.c Sat Feb 06 23:22:04 2010 +0200
@@ -98,8 +98,16 @@ int mdbox_save_begin(struct mail_save_co
uoff_t mail_size, append_offset;
/* get the size of the mail to be saved, if possible */
- if (i_stream_get_size(input, TRUE, &mail_size) <= 0)
- mail_size = 0;
+ if (i_stream_get_size(input, TRUE, &mail_size) <= 0) {
+ const struct stat *st;
+
+ /* we couldn't find out the exact size. fallback to non-exact,
+ maybe it'll give something useful. the mail size is used
+ only to figure out if it's causing mdbox file to grow
+ too large. */
+ st = i_stream_stat(input, FALSE);
+ mail_size = st->st_size > 0 ? st->st_size : 0;
+ }
if (dbox_map_append_next(ctx->append_ctx, mail_size,
&ctx->cur_file_append,
&ctx->ctx.cur_output) < 0) {
More information about the dovecot-cvs
mailing list