summaryrefslogtreecommitdiff
path: root/udev_selinux.c
diff options
context:
space:
mode:
authorHarald Hoyer <harald@redhat.com>2007-04-12 01:10:08 +0200
committerKay Sievers <kay.sievers@vrfy.org>2007-04-12 01:10:08 +0200
commit7c70c25212fe1b4918c4d7f270c46430111ad365 (patch)
treed2d01ecb2b56ae2d48bbe5887d0e251506c84bae /udev_selinux.c
parent0809c264e9878cdd1c61d9fb0e077972bc596ef8 (diff)
create_floppy_devices: create nodes with correct selinux context
Diffstat (limited to 'udev_selinux.c')
-rw-r--r--udev_selinux.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/udev_selinux.c b/udev_selinux.c
index 42568e4195..77c0e7dc4a 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");