summaryrefslogtreecommitdiff
path: root/src/hwdb/hwdb.c
diff options
context:
space:
mode:
authorEvgeny Vereshchagin <evvers@ya.ru>2016-06-07 20:47:41 +0300
committerLennart Poettering <lennart@poettering.net>2016-06-07 19:47:41 +0200
commitea683512f9b82f2257770f0ed56d819eea230fc2 (patch)
tree34fcd9aac0d908d3f948bc92280ed7e389eb7503 /src/hwdb/hwdb.c
parenta849538e3bf0097595fc1fd86bcda608d1151b4c (diff)
downloadsystemd-ea683512f9b82f2257770f0ed56d819eea230fc2.tar.gz
systemd-ea683512f9b82f2257770f0ed56d819eea230fc2.tar.bz2
systemd-ea683512f9b82f2257770f0ed56d819eea230fc2.zip
hwdb: selinuxify a bit (#3460)
-bash-4.3# rm /etc/udev/hwdb.bin -bash-4.3# systemd-hwdb update -bash-4.3# ls -Z /etc/udev/hwdb.bin system_u:object_r:systemd_hwdb_etc_t:s0 /etc/udev/hwdb.bin Fixes: #3458
Diffstat (limited to 'src/hwdb/hwdb.c')
-rw-r--r--src/hwdb/hwdb.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/hwdb/hwdb.c b/src/hwdb/hwdb.c
index 1160dacdf1..e12cd93d1c 100644
--- a/src/hwdb/hwdb.c
+++ b/src/hwdb/hwdb.c
@@ -29,7 +29,9 @@
#include "fs-util.h"
#include "hwdb-internal.h"
#include "hwdb-util.h"
+#include "label.h"
#include "mkdir.h"
+#include "selinux-util.h"
#include "strbuf.h"
#include "string-util.h"
#include "strv.h"
@@ -643,12 +645,12 @@ static int hwdb_update(int argc, char *argv[], void *userdata) {
if (!hwdb_bin)
return -ENOMEM;
- mkdir_parents(hwdb_bin, 0755);
+ mkdir_parents_label(hwdb_bin, 0755);
r = trie_store(trie, hwdb_bin);
if (r < 0)
return log_error_errno(r, "Failure writing database %s: %m", hwdb_bin);
- return 0;
+ return label_fix(hwdb_bin, false, false);
}
static void help(void) {
@@ -732,6 +734,8 @@ int main (int argc, char *argv[]) {
if (r <= 0)
goto finish;
+ mac_selinux_init();
+
r = hwdb_main(argc, argv);
finish: