Blame SOURCES/0340-udevadm-explicitly-relabel-etc-udev-hwdb.bin-after-r.patch

17b0f1
From 0860805a09ce6c2c2136306bdf64d58621368291 Mon Sep 17 00:00:00 2001
17b0f1
From: Michal Sekletar <msekleta@redhat.com>
17b0f1
Date: Fri, 8 Jul 2016 15:54:55 +0200
17b0f1
Subject: [PATCH] udevadm: explicitly relabel /etc/udev/hwdb.bin after rename
17b0f1
17b0f1
This is basically the same change as ea68351.
17b0f1
17b0f1
Cherry-picked from: 4f43161e909cb420aafbc4bebce4361b17b80fdd
17b0f1
Related: #1350756
17b0f1
---
17b0f1
 src/udev/udevadm-hwdb.c | 5 ++++-
17b0f1
 src/udev/udevadm.c      | 2 +-
17b0f1
 2 files changed, 5 insertions(+), 2 deletions(-)
17b0f1
17b0f1
diff --git a/src/udev/udevadm-hwdb.c b/src/udev/udevadm-hwdb.c
17b0f1
index d65e40c011..201e2a0cd2 100644
17b0f1
--- a/src/udev/udevadm-hwdb.c
17b0f1
+++ b/src/udev/udevadm-hwdb.c
17b0f1
@@ -26,6 +26,8 @@
17b0f1
 #include "util.h"
17b0f1
 #include "strbuf.h"
17b0f1
 #include "conf-files.h"
17b0f1
+#include "label.h"
17b0f1
+#include "mkdir.h"
17b0f1
 
17b0f1
 #include "udev.h"
17b0f1
 #include "hwdb-internal.h"
17b0f1
@@ -654,12 +656,13 @@ static int adm_hwdb(struct udev *udev, int argc, char *argv[]) {
17b0f1
                         rc = EXIT_FAILURE;
17b0f1
                         goto out;
17b0f1
                 }
17b0f1
-                mkdir_parents(hwdb_bin, 0755);
17b0f1
+                mkdir_parents_label(hwdb_bin, 0755);
17b0f1
                 err = trie_store(trie, hwdb_bin);
17b0f1
                 if (err < 0) {
17b0f1
                         log_error_errno(err, "Failure writing database %s: %m", hwdb_bin);
17b0f1
                         rc = EXIT_FAILURE;
17b0f1
                 }
17b0f1
+                label_fix(hwdb_bin, false, false);
17b0f1
         }
17b0f1
 
17b0f1
         if (test) {
17b0f1
diff --git a/src/udev/udevadm.c b/src/udev/udevadm.c
17b0f1
index 56cd0cd4ec..d05a26e788 100644
17b0f1
--- a/src/udev/udevadm.c
17b0f1
+++ b/src/udev/udevadm.c
17b0f1
@@ -96,7 +96,7 @@ int main(int argc, char *argv[]) {
17b0f1
 
17b0f1
         log_parse_environment();
17b0f1
         log_open();
17b0f1
-        mac_selinux_init("/dev");
17b0f1
+        mac_selinux_init(NULL);
17b0f1
 
17b0f1
         while ((c = getopt_long(argc, argv, "+dhV", options, NULL)) >= 0)
17b0f1
                 switch (c) {