teknoraver / rpms / systemd

Forked from rpms/systemd 3 months ago
Clone

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

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