[ostree] core: Initialize checksums for non-regular files, handle NULL xattrs
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] core: Initialize checksums for non-regular files, handle NULL xattrs
- Date: Sun, 4 Dec 2011 19:10:26 +0000 (UTC)
commit 1f6d49cdb90df1809f0b4ac9c4c85b16a0e9a271
Author: Colin Walters <walters verbum org>
Date: Sun Dec 4 12:11:29 2011 -0500
core: Initialize checksums for non-regular files, handle NULL xattrs
src/libostree/ostree-core.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/src/libostree/ostree-core.c b/src/libostree/ostree-core.c
index 881ef04..5fd9e9b 100644
--- a/src/libostree/ostree-core.c
+++ b/src/libostree/ostree-core.c
@@ -437,7 +437,7 @@ ostree_create_directory_metadata (GFileInfo *dir_info,
GUINT32_TO_BE (g_file_info_get_attribute_uint32 (dir_info, "unix::uid")),
GUINT32_TO_BE (g_file_info_get_attribute_uint32 (dir_info, "unix::gid")),
GUINT32_TO_BE (g_file_info_get_attribute_uint32 (dir_info, "unix::mode")),
- xattrs);
+ xattrs ? xattrs : g_variant_new_array (G_VARIANT_TYPE ("(ayay)"), NULL, 0));
g_variant_ref_sink (ret_metadata);
return ret_metadata;
@@ -930,6 +930,8 @@ ostree_create_file_from_input (GFile *dest_file,
{
const char *target = g_file_info_get_attribute_byte_string (finfo, "standard::symlink-target");
g_assert (objtype == OSTREE_OBJECT_TYPE_FILE);
+ if (out_checksum)
+ ret_checksum = g_checksum_new (G_CHECKSUM_SHA256);
if (ret_checksum)
g_checksum_update (ret_checksum, (guint8*)target, strlen (target));
if (symlink (target, dest_path) < 0)
@@ -944,6 +946,8 @@ ostree_create_file_from_input (GFile *dest_file,
guint32 dev_be;
g_assert (objtype == OSTREE_OBJECT_TYPE_FILE);
dev_be = GUINT32_TO_BE (dev);
+ if (out_checksum)
+ ret_checksum = g_checksum_new (G_CHECKSUM_SHA256);
if (ret_checksum)
g_checksum_update (ret_checksum, (guint8*)&dev_be, 4);
if (mknod (dest_path, mode, dev) < 0)
@@ -955,6 +959,8 @@ ostree_create_file_from_input (GFile *dest_file,
else if (S_ISFIFO (mode))
{
g_assert (objtype == OSTREE_OBJECT_TYPE_FILE);
+ if (out_checksum)
+ ret_checksum = g_checksum_new (G_CHECKSUM_SHA256);
if (mkfifo (dest_path, mode) < 0)
{
ot_util_set_error_from_errno (error, errno);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]