dovecot-2.2: lib-storage: Fixed subscription file reading when f...

dovecot at dovecot.org dovecot at dovecot.org
Thu Apr 23 08:22:32 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/fedd88ce9315
changeset: 18448:fedd88ce9315
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Apr 23 11:20:53 2015 +0300
description:
lib-storage: Fixed subscription file reading when file was (nearly) empty.
Broken by the earlier changes.

diffstat:

 src/lib-storage/list/subscription-file.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (18 lines):

diff -r faafabb58036 -r fedd88ce9315 src/lib-storage/list/subscription-file.c
--- a/src/lib-storage/list/subscription-file.c	Wed Apr 22 18:17:10 2015 +0300
+++ b/src/lib-storage/list/subscription-file.c	Thu Apr 23 11:20:53 2015 +0300
@@ -70,10 +70,12 @@
 	ret = i_stream_read_data(input, &data, &size, version2_header_len-1);
 	if (ret < 0) {
 		i_assert(ret == -1);
-		subswrite_set_syscall_error(list, "read()", i_stream_get_name(input));
+		if (input->stream_errno != 0)
+			subswrite_set_syscall_error(list, "read()", i_stream_get_name(input));
 		return;
 	}
-	if (memcmp(data, version2_header, version2_header_len) == 0) {
+	if (ret > 0 &&
+	    memcmp(data, version2_header, version2_header_len) == 0) {
 		*version_r = 2;
 		i_stream_skip(input, version2_header_len);
 	}


More information about the dovecot-cvs mailing list