|
|
9376d4 |
From 4a5e9c3086da507f7be9bdf84b17aaaca4d18ad7 Mon Sep 17 00:00:00 2001
|
|
|
9376d4 |
From: Jonathan Lebon <jlebon@redhat.com>
|
|
|
9376d4 |
Date: Thu, 15 Jun 2017 13:20:34 -0400
|
|
|
9376d4 |
Subject: [PATCH 2/4] postprocess: use glnx_throw helpers to add details
|
|
|
9376d4 |
|
|
|
9376d4 |
Closes: #831
|
|
|
9376d4 |
Approved by: cgwalters
|
|
|
9376d4 |
---
|
|
|
9376d4 |
src/libpriv/rpmostree-postprocess.c | 20 ++++----------------
|
|
|
9376d4 |
1 file changed, 4 insertions(+), 16 deletions(-)
|
|
|
9376d4 |
|
|
|
9376d4 |
diff --git a/src/libpriv/rpmostree-postprocess.c b/src/libpriv/rpmostree-postprocess.c
|
|
|
9376d4 |
index db24c70..77ad66a 100644
|
|
|
9376d4 |
--- a/src/libpriv/rpmostree-postprocess.c
|
|
|
9376d4 |
+++ b/src/libpriv/rpmostree-postprocess.c
|
|
|
9376d4 |
@@ -595,10 +595,7 @@ postprocess_selinux_policy_store_location (int rootfs_dfd,
|
|
|
9376d4 |
if (fstatat (rootfs_dfd, var_policy_location, &stbuf, 0) != 0)
|
|
|
9376d4 |
{
|
|
|
9376d4 |
if (errno != ENOENT)
|
|
|
9376d4 |
- {
|
|
|
9376d4 |
- glnx_set_error_from_errno (error);
|
|
|
9376d4 |
- return FALSE;
|
|
|
9376d4 |
- }
|
|
|
9376d4 |
+ return glnx_throw_errno_prefix (error, "fstat(%s)", modules_location);
|
|
|
9376d4 |
|
|
|
9376d4 |
/* Okay, this is probably CentOS 7, or maybe we have a build of
|
|
|
9376d4 |
* selinux-policy with the path moved back into /etc (or maybe it's
|
|
|
9376d4 |
@@ -615,28 +612,19 @@ postprocess_selinux_policy_store_location (int rootfs_dfd,
|
|
|
9376d4 |
orig_contents = glnx_file_get_contents_utf8_at (rootfs_dfd, semanage_path, NULL,
|
|
|
9376d4 |
cancellable, error);
|
|
|
9376d4 |
if (orig_contents == NULL)
|
|
|
9376d4 |
- {
|
|
|
9376d4 |
- g_prefix_error (error, "Opening %s: ", semanage_path);
|
|
|
9376d4 |
- return FALSE;
|
|
|
9376d4 |
- }
|
|
|
9376d4 |
+ return glnx_prefix_error (error, "Opening %s:", semanage_path);
|
|
|
9376d4 |
|
|
|
9376d4 |
contents = g_strconcat (orig_contents, "\nstore-root=/etc/selinux\n", NULL);
|
|
|
9376d4 |
|
|
|
9376d4 |
if (!glnx_file_replace_contents_at (rootfs_dfd, semanage_path,
|
|
|
9376d4 |
(guint8*)contents, -1, 0,
|
|
|
9376d4 |
cancellable, error))
|
|
|
9376d4 |
- {
|
|
|
9376d4 |
- g_prefix_error (error, "Replacing %s: ", semanage_path);
|
|
|
9376d4 |
- return FALSE;
|
|
|
9376d4 |
- }
|
|
|
9376d4 |
+ return glnx_prefix_error (error, "Replacing %s:", semanage_path);
|
|
|
9376d4 |
}
|
|
|
9376d4 |
|
|
|
9376d4 |
etc_policy_location = glnx_strjoina ("etc/selinux/", name);
|
|
|
9376d4 |
if (!glnx_opendirat (rootfs_dfd, etc_policy_location, TRUE, &etc_selinux_dfd, error))
|
|
|
9376d4 |
- {
|
|
|
9376d4 |
- g_prefix_error (error, "Opening %s: ", etc_policy_location);
|
|
|
9376d4 |
- return FALSE;
|
|
|
9376d4 |
- }
|
|
|
9376d4 |
+ return glnx_prefix_error (error, "Opening %s:", etc_policy_location);
|
|
|
9376d4 |
|
|
|
9376d4 |
if (!glnx_dirfd_iterator_init_at (rootfs_dfd, var_policy_location, TRUE, &dfd_iter, error))
|
|
|
9376d4 |
return FALSE;
|
|
|
9376d4 |
--
|
|
|
9376d4 |
2.13.0
|
|
|
9376d4 |
|