Some existing code calls into ostree_raw_file_to_content_stream() with
file objects that do not have the standard::size attribute. Since GLib
2.76.0, attempting to access the size of such an object raises a
critical warning. Handle this more gracefully by defaulting the size
to 0, like earlier versions of GLib did.
Signed-off-by: Simon McVittie <smcv@collabora.com>
g_autoptr(GBytes) file_header = _ostree_file_header_new (file_info, xattrs);
*out_input = header_and_input_to_stream (file_header, input);
if (out_length)
- *out_length = g_bytes_get_size (file_header) + g_file_info_get_size (file_info);
+ *out_length = g_bytes_get_size (file_header);
+ if (out_length && g_file_info_has_attribute (file_info, "standard::size"))
+ *out_length += g_file_info_get_size (file_info);
return TRUE;
}