]> err.no Git - systemd/commitdiff
create_floppy_devices: create nodes with correct selinux context
authorHarald Hoyer <harald@redhat.com>
Wed, 11 Apr 2007 23:10:08 +0000 (01:10 +0200)
committerKay Sievers <kay.sievers@vrfy.org>
Wed, 11 Apr 2007 23:10:08 +0000 (01:10 +0200)
extras/floppy/create_floppy_devices.c
udev_selinux.c

index 7a3ddb2ffeb29d7ea231ae64aefef4ac2a653f14..7c1ea0715a508a471c7c769586eecadaa346563a 100644 (file)
@@ -155,6 +155,7 @@ int main(int argc, char **argv)
        if (type == 0)
                return 0;
 
+       udev_config_init();
        selinux_init();
 
        i = 0;
index 42568e4195339cebcef289510799464b7b8fad7e..77c0e7dc4a3de6ffbf0f695e8b5b08c40f2d4a52 100644 (file)
@@ -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");