diff options
author | Colin Walters <walters@verbum.org> | 2023-03-17 11:28:18 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-17 11:28:18 -0400 |
commit | 233cc8ce85e46a9a28ce302dd8d003f141531d69 (patch) | |
tree | b18d2eccda3534696ed82750dcea56b80a9031cb /src/libostree/ostree-core.c | |
parent | 7b258b2499d211b672ce3b64a0f9312208f73c0b (diff) | |
parent | 1b29ab7d90d9d93eedd7cd3e49c500e1ca3e3f47 (diff) | |
download | ostree-233cc8ce85e46a9a28ce302dd8d003f141531d69.tar.gz |
Merge pull request #2836 from smcv/file-info-size
Cope with GLib 2.76 being more strict about GFileInfo standard::size
Diffstat (limited to 'src/libostree/ostree-core.c')
-rw-r--r-- | src/libostree/ostree-core.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/libostree/ostree-core.c b/src/libostree/ostree-core.c index ee0552f6..adb9d70c 100644 --- a/src/libostree/ostree-core.c +++ b/src/libostree/ostree-core.c @@ -355,7 +355,7 @@ GBytes * _ostree_zlib_file_header_new (GFileInfo *file_info, GVariant *xattrs) { - guint64 size = g_file_info_get_size (file_info); + guint64 size = 0; guint32 uid = g_file_info_get_attribute_uint32 (file_info, "unix::uid"); guint32 gid = g_file_info_get_attribute_uint32 (file_info, "unix::gid"); guint32 mode = g_file_info_get_attribute_uint32 (file_info, "unix::mode"); @@ -366,6 +366,9 @@ _ostree_zlib_file_header_new (GFileInfo *file_info, else symlink_target = ""; + if (g_file_info_has_attribute (file_info, "standard::size")) + size = g_file_info_get_size (file_info); + g_autoptr(GVariant) tmp_xattrs = NULL; if (xattrs == NULL) tmp_xattrs = g_variant_ref_sink (g_variant_new_array (G_VARIANT_TYPE ("(ayay)"), NULL, 0)); @@ -550,7 +553,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; } |