ryantimwilson / rpms / systemd

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