]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-fs: fs-metawrap stat() error handling improvement.
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 4 May 2016 15:34:59 +0000 (18:34 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 4 May 2016 15:34:59 +0000 (18:34 +0300)
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.

src/lib-fs/fs-metawrap.c

index 0e9f09f70d7a54d7dca57ac69f228436c42b9025..9785ee7f43c69d6b2a3d7787b3ea3b658d95998f 100644 (file)
@@ -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;
        }