From: Timo Sirainen Date: Thu, 23 Apr 2015 08:20:53 +0000 (+0300) Subject: lib-storage: Fixed subscription file reading when file was (nearly) empty. X-Git-Tag: 2.2.17.rc1~173 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=59eba6fc8b6c8d49cac458d8bfefbf163c13d5f7;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: Fixed subscription file reading when file was (nearly) empty. Broken by the earlier changes. --- diff --git a/src/lib-storage/list/subscription-file.c b/src/lib-storage/list/subscription-file.c index 8ea0bf44f4..640a7e3904 100644 --- a/src/lib-storage/list/subscription-file.c +++ b/src/lib-storage/list/subscription-file.c @@ -70,10 +70,12 @@ subsfile_list_read_header(struct mailbox_list *list, struct istream *input, 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); }