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.
}
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;
}