dovecot-2.2: mdbox: Replaced non-error-checking i_stream_stat() ...

dovecot at dovecot.org dovecot at dovecot.org
Tue Aug 28 22:16:16 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/cbe8fe1b44f0
changeset: 14961:cbe8fe1b44f0
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Aug 28 22:15:49 2012 +0300
description:
mdbox: Replaced non-error-checking i_stream_stat() with potentially faster i_stream_get_size().

diffstat:

 src/lib-storage/index/dbox-multi/mdbox-save.c |  6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diffs (20 lines):

diff -r 6d2a439a10a6 -r cbe8fe1b44f0 src/lib-storage/index/dbox-multi/mdbox-save.c
--- a/src/lib-storage/index/dbox-multi/mdbox-save.c	Tue Aug 28 14:46:16 2012 +0300
+++ b/src/lib-storage/index/dbox-multi/mdbox-save.c	Tue Aug 28 22:15:49 2012 +0300
@@ -132,14 +132,12 @@
 
 	/* get the size of the mail to be saved, if possible */
 	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 (i_stream_get_size(input, FALSE, &mail_size) <= 0)
+			mail_size = 0;
 	}
 	if (mdbox_map_append_next(ctx->append_ctx, mail_size, 0,
 				  &ctx->cur_file_append,


More information about the dovecot-cvs mailing list