summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--udev_selinux.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/udev_selinux.c b/udev_selinux.c
index b802e1fc6e..a305e24136 100644
--- a/udev_selinux.c
+++ b/udev_selinux.c
@@ -90,10 +90,13 @@ void selinux_setfilecon(const char *file, const char *devname, unsigned int mode
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)
@@ -102,7 +105,7 @@ void selinux_setfilecon(const char *file, const char *devname, unsigned int mode
return;
}
- if (setfilecon(file, scontext) < 0)
+ if (lsetfilecon(file, scontext) < 0)
err("setfilecon %s failed: %s", file, strerror(errno));
freecon(scontext);