summaryrefslogtreecommitdiff
path: root/src/libostree/ostree-repo-checkout.c
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2014-12-04 20:19:09 +0100
committerAlexander Larsson <alexl@redhat.com>2014-12-04 20:30:10 +0100
commitbb82c17701ad36bd6a408a8212164d42f70f65fb (patch)
tree51445baa65dccaf4393f50fde97eff0f7fd3ae02 /src/libostree/ostree-repo-checkout.c
parent37a059925f6b96d30190b65bee6bdde0ae1c6915 (diff)
downloadostree-bb82c17701ad36bd6a408a8212164d42f70f65fb.tar.gz
checkout: fchown symlink to proper uid/gid
When commiting a symlink we do store the uid/gid of the actual symlink (i.e. not target). However, this was not restored on non-user-mode checkout as it should. This commit fixes that, and additionally it ensures xattrs on symlinks are not set in user-mode checkout. https://bugzilla.gnome.org/show_bug.cgi?id=741125
Diffstat (limited to 'src/libostree/ostree-repo-checkout.c')
-rw-r--r--src/libostree/ostree-repo-checkout.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/libostree/ostree-repo-checkout.c b/src/libostree/ostree-repo-checkout.c
index 03efd601..29243d51 100644
--- a/src/libostree/ostree-repo-checkout.c
+++ b/src/libostree/ostree-repo-checkout.c
@@ -189,12 +189,24 @@ checkout_file_from_input_at (OstreeRepoCheckoutMode mode,
ot_util_set_error_from_errno (error, errno);
goto out;
}
-
- if (xattrs)
+
+ if (mode != OSTREE_REPO_CHECKOUT_MODE_USER)
{
- if (!gs_dfd_and_name_set_all_xattrs (destination_dfd, destination_name,
- xattrs, cancellable, error))
- goto out;
+ if (G_UNLIKELY (fchownat (destination_dfd, destination_name,
+ g_file_info_get_attribute_uint32 (file_info, "unix::uid"),
+ g_file_info_get_attribute_uint32 (file_info, "unix::gid"),
+ AT_SYMLINK_NOFOLLOW) == -1))
+ {
+ ot_util_set_error_from_errno (error, errno);
+ goto out;
+ }
+
+ if (xattrs)
+ {
+ if (!gs_dfd_and_name_set_all_xattrs (destination_dfd, destination_name,
+ xattrs, cancellable, error))
+ goto out;
+ }
}
}
else if (g_file_info_get_file_type (file_info) == G_FILE_TYPE_REGULAR)