changeset 10651:b1597605c3ef HEAD

mbox: raw mbox stream's stat() now returns mail size as stream size if it's known.
author Timo Sirainen <tss@iki.fi>
date Sat, 06 Feb 2010 23:22:15 +0200
parents e9f4efacf692
children bdb1ea37ccee
files src/lib-storage/index/mbox/istream-raw-mbox.c
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/mbox/istream-raw-mbox.c	Sat Feb 06 23:22:04 2010 +0200
+++ b/src/lib-storage/index/mbox/istream-raw-mbox.c	Sat Feb 06 23:22:15 2010 +0200
@@ -410,13 +410,16 @@
 i_stream_raw_mbox_stat(struct istream_private *stream, bool exact)
 {
 	const struct stat *st;
+	struct raw_mbox_istream *rstream = (struct raw_mbox_istream *)stream;
 
 	st = i_stream_stat(stream->parent, exact);
 	if (st == NULL)
 		return NULL;
 
 	stream->statbuf = *st;
-	stream->statbuf.st_size = -1;
+	stream->statbuf.st_size =
+		!exact && rstream->seeked && rstream->mail_size != (uoff_t)-1 ?
+		(off_t)rstream->mail_size : -1;
 	return &stream->statbuf;
 }