Skip to content

Commit

Permalink
lib-fs: fs-metawrap stat() error handling improvement.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sirainen committed May 10, 2016
1 parent b0626c0 commit e36e974
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lib-fs/fs-metawrap.c
Expand Up @@ -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;
}

Expand Down

0 comments on commit e36e974

Please sign in to comment.