From: Aki Tuomi Date: Fri, 16 Mar 2018 11:40:26 +0000 (+0200) Subject: istream-seekable: Record stream size in stat X-Git-Tag: 2.3.9~2123 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=68efac63dc693168a6e18cc5107d00d9c3a11c5d;p=thirdparty%2Fdovecot%2Fcore.git istream-seekable: Record stream size in stat Otherwise the size is shown 0 --- diff --git a/src/lib/istream-seekable.c b/src/lib/istream-seekable.c index 228fc79b19..875bba667f 100644 --- a/src/lib/istream-seekable.c +++ b/src/lib/istream-seekable.c @@ -327,7 +327,7 @@ i_stream_seekable_stat(struct istream_private *stream, bool exact) { struct seekable_istream *sstream = (struct seekable_istream *)stream; const struct stat *st; - uoff_t old_offset; + uoff_t old_offset, len; ssize_t ret; if (sstream->size != (uoff_t)-1) { @@ -351,6 +351,7 @@ i_stream_seekable_stat(struct istream_private *stream, bool exact) sstream->cur_input->v_offset); } i_stream_skip(&stream->istream, stream->pos - stream->skip); + len = stream->pos; i_stream_seek(&stream->istream, old_offset); unref_streams(sstream); @@ -366,7 +367,7 @@ i_stream_seekable_stat(struct istream_private *stream, bool exact) /* buffer is completely in memory */ i_assert(sstream->fd == -1); - stream->statbuf.st_size = stream->pos; + stream->statbuf.st_size = len; } return 0; }