From: Timo Sirainen Date: Wed, 4 May 2016 15:34:59 +0000 (+0300) Subject: lib-fs: fs-metawrap stat() error handling improvement. X-Git-Tag: 2.2.25.rc1~330 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e36e97499078ff53671e00de863379b89823368c;p=thirdparty%2Fdovecot%2Fcore.git lib-fs: fs-metawrap stat() error handling improvement. We can't just treat i_stream_get_size() returning 0 as the reason being istream is async and not fully read. It might be, but it might also be because of other reasons. And since we're closing the istream we couldn't even properly finish up the async handling. So for now just return an error if we see this happening. --- diff --git a/src/lib-fs/fs-metawrap.c b/src/lib-fs/fs-metawrap.c index 0e9f09f70d..9785ee7f43 100644 --- a/src/lib-fs/fs-metawrap.c +++ b/src/lib-fs/fs-metawrap.c @@ -503,7 +503,10 @@ static int fs_metawrap_stat(struct fs_file *_file, struct stat *st_r) } i_stream_unref(&input); if (ret == 0) { - fs_set_error_async(_file->fs); + /* we shouldn't get here */ + fs_set_error(_file->fs, "i_stream_get_size(%s) returned size as unknown", + fs_file_path(_file)); + errno = EIO; return -1; }