From 7c70c25212fe1b4918c4d7f270c46430111ad365 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Thu, 12 Apr 2007 01:10:08 +0200 Subject: [PATCH] create_floppy_devices: create nodes with correct selinux context --- extras/floppy/create_floppy_devices.c | 1 + udev_selinux.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/extras/floppy/create_floppy_devices.c b/extras/floppy/create_floppy_devices.c index 7a3ddb2f..7c1ea071 100644 --- a/extras/floppy/create_floppy_devices.c +++ b/extras/floppy/create_floppy_devices.c @@ -155,6 +155,7 @@ int main(int argc, char **argv) if (type == 0) return 0; + udev_config_init(); selinux_init(); i = 0; diff --git a/udev_selinux.c b/udev_selinux.c index 42568e41..77c0e7dc 100644 --- a/udev_selinux.c +++ b/udev_selinux.c @@ -118,10 +118,12 @@ void selinux_setfscreatecon(const char *file, const char *devname, unsigned int char *media; int ret = -1; - media = get_media(devname, mode); - if (media) { - ret = matchmediacon(media, &scontext); - free(media); + if (devname) { + media = get_media(devname, mode); + if (media) { + ret = matchmediacon(media, &scontext); + free(media); + } } if (ret < 0) @@ -152,6 +154,8 @@ void selinux_init(void) * restoration creation purposes. */ if (is_selinux_running()) { + if (!udev_root[0]) + err("selinux_init: udev_root not set\n"); matchpathcon_init_prefix(NULL, udev_root); if (getfscreatecon(&prev_scontext) < 0) { err("getfscreatecon failed\n"); -- 2.39.5