From: Timo Sirainen Date: Tue, 28 Aug 2012 19:15:49 +0000 (+0300) Subject: mdbox: Replaced non-error-checking i_stream_stat() with potentially faster i_stream_g... X-Git-Tag: 2.2.alpha1~279 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=46908da82cd45dd90ca7e438c8453bc9669868ec;p=thirdparty%2Fdovecot%2Fcore.git mdbox: Replaced non-error-checking i_stream_stat() with potentially faster i_stream_get_size(). --- diff --git a/src/lib-storage/index/dbox-multi/mdbox-save.c b/src/lib-storage/index/dbox-multi/mdbox-save.c index dc8109d198..1131ce7a35 100644 --- a/src/lib-storage/index/dbox-multi/mdbox-save.c +++ b/src/lib-storage/index/dbox-multi/mdbox-save.c @@ -132,14 +132,12 @@ int mdbox_save_begin(struct mail_save_context *_ctx, struct istream *input) /* 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,