[dovecot-cvs] dovecot/src/lib istream-seekable.c,1.8,1.8.2.1
tss at dovecot.org
tss at dovecot.org
Fri Jan 26 00:42:39 UTC 2007
Update of /var/lib/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv31895
Modified Files:
Tag: branch_1_0
istream-seekable.c
Log Message:
cleanup
Index: istream-seekable.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/istream-seekable.c,v
retrieving revision 1.8
retrieving revision 1.8.2.1
diff -u -d -r1.8 -r1.8.2.1
--- istream-seekable.c 14 Jan 2006 18:47:22 -0000 1.8
+++ istream-seekable.c 26 Jan 2007 00:42:32 -0000 1.8.2.1
@@ -270,6 +270,8 @@
ssize_t ret;
if (sstream->buffer != NULL) {
+ /* we want to know the full size of the file, so read until
+ we're finished */
old_offset = stream->istream.v_offset;
do {
i_stream_skip(&stream->istream, stream->skip);
@@ -282,11 +284,16 @@
i_stream_seek(&stream->istream, old_offset);
}
- if (sstream->fd_input != NULL)
+ if (sstream->fd_input != NULL) {
+ /* using a file backed buffer, we can use real fstat() */
return i_stream_stat(sstream->fd_input, exact);
+ } else {
+ /* buffer is completely in memory */
+ i_assert(sstream->buffer != NULL);
- stream->statbuf.st_size = sstream->buffer->used;
- return &stream->statbuf;
+ stream->statbuf.st_size = sstream->buffer->used;
+ return &stream->statbuf;
+ }
}
struct istream *
More information about the dovecot-cvs
mailing list