summaryrefslogtreecommitdiff
path: root/src/libostree/ostree-core.c
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2023-03-17 11:28:18 -0400
committerGitHub <noreply@github.com>2023-03-17 11:28:18 -0400
commit233cc8ce85e46a9a28ce302dd8d003f141531d69 (patch)
treeb18d2eccda3534696ed82750dcea56b80a9031cb /src/libostree/ostree-core.c
parent7b258b2499d211b672ce3b64a0f9312208f73c0b (diff)
parent1b29ab7d90d9d93eedd7cd3e49c500e1ca3e3f47 (diff)
downloadostree-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.c9
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;
}