summaryrefslogtreecommitdiff
path: root/src/mount-setup.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-11-07 22:59:39 -0500
committerLennart Poettering <lennart@poettering.net>2010-11-10 22:38:43 +0100
commit1829dc9dc5f38cd1aaa43912de56c3bb5d8b5617 (patch)
treee5c339ed6e00522b82d336d4498c5322e3621823 /src/mount-setup.c
parent31a7034d38fd7550699e6fbd002bbe42d9ea3b7e (diff)
selinux: relabel /dev after loading policy
Diffstat (limited to 'src/mount-setup.c')
-rw-r--r--src/mount-setup.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/mount-setup.c b/src/mount-setup.c
index fe99f58b66..84a729ebf2 100644
--- a/src/mount-setup.c
+++ b/src/mount-setup.c
@@ -27,6 +27,7 @@
#include <libgen.h>
#include <assert.h>
#include <unistd.h>
+#include <ftw.h>
#include "mount-setup.h"
#include "log.h"
@@ -189,6 +190,16 @@ static int symlink_and_label(const char *old_path, const char *new_path) {
return r;
}
+static int nftw_cb(
+ const char *fpath,
+ const struct stat *sb,
+ int tflag,
+ struct FTW *ftwbuf) {
+
+ label_fix(fpath);
+ return 0;
+};
+
int mount_setup(void) {
const char *symlinks =
@@ -207,6 +218,13 @@ int mount_setup(void) {
if ((r = mount_one(mount_table+i)) < 0)
return r;
+ /* Nodes in devtmpfs need to be manually updated for the
+ * appropriate labels, after mounting. The other virtual API
+ * file systems do not need. */
+
+ if (unlink("/dev/.systemd/relabel-devtmpfs") >= 0)
+ nftw("/dev", nftw_cb, 64, FTW_MOUNT|FTW_PHYS);
+
/* Create a few default symlinks, which are normally created
* bei udevd, but some scripts might need them before we start
* udevd. */