Blob Blame History Raw
From 4a5e9c3086da507f7be9bdf84b17aaaca4d18ad7 Mon Sep 17 00:00:00 2001
From: Jonathan Lebon <jlebon@redhat.com>
Date: Thu, 15 Jun 2017 13:20:34 -0400
Subject: [PATCH 2/4] postprocess: use glnx_throw helpers to add details

Closes: #831
Approved by: cgwalters
---
 src/libpriv/rpmostree-postprocess.c | 20 ++++----------------
 1 file changed, 4 insertions(+), 16 deletions(-)

diff --git a/src/libpriv/rpmostree-postprocess.c b/src/libpriv/rpmostree-postprocess.c
index db24c70..77ad66a 100644
--- a/src/libpriv/rpmostree-postprocess.c
+++ b/src/libpriv/rpmostree-postprocess.c
@@ -595,10 +595,7 @@ postprocess_selinux_policy_store_location (int rootfs_dfd,
   if (fstatat (rootfs_dfd, var_policy_location, &stbuf, 0) != 0)
     {
       if (errno != ENOENT)
-        {
-          glnx_set_error_from_errno (error);
-          return FALSE;
-        }
+        return glnx_throw_errno_prefix (error, "fstat(%s)", modules_location);
 
       /* Okay, this is probably CentOS 7, or maybe we have a build of
        * selinux-policy with the path moved back into /etc (or maybe it's
@@ -615,28 +612,19 @@ postprocess_selinux_policy_store_location (int rootfs_dfd,
     orig_contents = glnx_file_get_contents_utf8_at (rootfs_dfd, semanage_path, NULL,
                                                     cancellable, error);
     if (orig_contents == NULL)
-      {
-        g_prefix_error (error, "Opening %s: ", semanage_path);
-        return FALSE;
-      }
+      return glnx_prefix_error (error, "Opening %s:", semanage_path);
 
     contents = g_strconcat (orig_contents, "\nstore-root=/etc/selinux\n", NULL);
 
     if (!glnx_file_replace_contents_at (rootfs_dfd, semanage_path,
                                         (guint8*)contents, -1, 0,
                                         cancellable, error))
-      {
-        g_prefix_error (error, "Replacing %s: ", semanage_path);
-        return FALSE;
-      }
+      return glnx_prefix_error (error, "Replacing %s:", semanage_path);
   }
 
   etc_policy_location = glnx_strjoina ("etc/selinux/", name);
   if (!glnx_opendirat (rootfs_dfd, etc_policy_location, TRUE, &etc_selinux_dfd, error))
-    {
-      g_prefix_error (error, "Opening %s: ", etc_policy_location);
-      return FALSE;
-    }
+    return glnx_prefix_error (error, "Opening %s:", etc_policy_location);
 
   if (!glnx_dirfd_iterator_init_at (rootfs_dfd, var_policy_location, TRUE, &dfd_iter, error))
     return FALSE;
-- 
2.13.0