diff options
author | Simon McVittie <smcv@collabora.com> | 2023-03-17 12:56:39 +0000 |
---|---|---|
committer | Simon McVittie <smcv@collabora.com> | 2023-03-17 12:56:39 +0000 |
commit | 1b29ab7d90d9d93eedd7cd3e49c500e1ca3e3f47 (patch) | |
tree | 94a304e9a11691c8c970aa67dbde329f77ef7eb9 | |
parent | 9e116c0f7983ce251b9ea661f14008603b552e42 (diff) | |
download | ostree-1b29ab7d90d9d93eedd7cd3e49c500e1ca3e3f47.tar.gz |
write_content_object: Don't assume file info has standard::size
The file info object for symlinks might validly not have this attribute.
If not, behave as though it was 0, matching what happened with older
versions of GLib.
Signed-off-by: Simon McVittie <smcv@collabora.com>
-rw-r--r-- | src/libostree/ostree-repo-commit.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libostree/ostree-repo-commit.c b/src/libostree/ostree-repo-commit.c index 2d4347b0..32119c47 100644 --- a/src/libostree/ostree-repo-commit.c +++ b/src/libostree/ostree-repo-commit.c @@ -1211,7 +1211,8 @@ write_content_object (OstreeRepo *self, /* Update statistics */ g_mutex_lock (&self->txn_lock); self->txn.stats.content_objects_written++; - self->txn.stats.content_bytes_written += g_file_info_get_size (file_info); + if (g_file_info_has_attribute (file_info, "standard::size")) + self->txn.stats.content_bytes_written += g_file_info_get_size (file_info); self->txn.stats.content_objects_total++; g_mutex_unlock (&self->txn_lock); |