dovecot-2.2: lib: If i_stream_read() sets stream_errno even if i...
dovecot at dovecot.org
dovecot at dovecot.org
Sun Feb 15 08:11:19 UTC 2015
details: http://hg.dovecot.org/dovecot-2.2/rev/d76d4351762b
changeset: 18251:d76d4351762b
user: Timo Sirainen <tss at iki.fi>
date: Sun Feb 15 09:55:05 2015 +0200
description:
lib: If i_stream_read() sets stream_errno even if it didn't return -1, make sure we set eof=TRUE
diffstat:
src/lib/istream.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diffs (26 lines):
diff -r 20babbc0dc24 -r d76d4351762b src/lib/istream.c
--- a/src/lib/istream.c Sun Feb 15 09:54:45 2015 +0200
+++ b/src/lib/istream.c Sun Feb 15 09:55:05 2015 +0200
@@ -137,6 +137,7 @@
ssize_t ret;
if (unlikely(stream->closed || stream->stream_errno != 0)) {
+ stream->eof = TRUE;
errno = stream->stream_errno;
return -1;
}
@@ -174,6 +175,14 @@
break;
}
+ if (stream->stream_errno != 0) {
+ /* error handling should be easier if we now just
+ assume the stream is now at EOF. Note that we could get here
+ even if read() didn't return -1, although that's a little
+ bit sloppy istream implementation. */
+ stream->eof = TRUE;
+ }
+
i_stream_update(_stream);
return ret;
}
More information about the dovecot-cvs
mailing list