anitazha / rpms / systemd

Forked from rpms/systemd 3 years ago
Clone

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

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