mirror of
https://github.com/ostreedev/ostree.git
synced 2025-03-13 00:58:43 +03:00
ostree_raw_file_to_content_stream: Make size default to 0
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>
This commit is contained in:
parent
4238ef4c68
commit
722a4179f3
@ -550,7 +550,9 @@ ostree_raw_file_to_content_stream (GInputStream *input,
|
||||
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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user