]> err.no Git - systemd/commitdiff
[PATCH] fix special file mode mask for temporary device node
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>
Thu, 10 Feb 2005 18:46:50 +0000 (19:46 +0100)
committerGreg KH <gregkh@suse.de>
Wed, 27 Apr 2005 06:33:50 +0000 (23:33 -0700)
test/udev-test.pl
udev_add.c

index 992fc0019a9398a22da5b24107cf40195c099313..1b1ee9092217acb32383b299a6ad1161e44d33cf 100644 (file)
@@ -1068,7 +1068,7 @@ EOF
                devpath         => "/block/sda",
                exp_name        => "sda",
                conf            => <<EOF
-BUS="scsi", KERNEL="sda", PROGRAM="/usr/bin/test -b %N" NAME="%N"
+BUS="scsi", KERNEL="sda", PROGRAM="/usr/bin/test -b %N" NAME="%N"
 EOF
        },
        {
index c566571c1ca6a688ce8f9d7a0c276a0fdeea3925..be62e130ab4cc33bf2f2bd111bbc4681a21ced3d 100644 (file)
@@ -89,6 +89,22 @@ int udev_make_node(struct udevice *udev, const char *file, int major, int minor,
                dbg("already present file '%s' unlinked", file);
 
 create:
+       switch (udev->type) {
+       case 'b':
+               mode |= S_IFBLK;
+               break;
+       case 'c':
+       case 'u':
+               mode |= S_IFCHR;
+               break;
+       case 'p':
+               mode |= S_IFIFO;
+               break;
+       default:
+               dbg("unknown node type %c\n", udev->type);
+               return -EINVAL;
+       }
+
        selinux_setfscreatecon(file, udev->kernel_name, mode);
        retval = mknod(file, mode, makedev(major, minor));
        if (retval != 0) {
@@ -131,24 +147,8 @@ static int create_node(struct udevice *udev, struct sysfs_class_device *class_de
        snprintf(filename, NAME_SIZE, "%s/%s", udev_root, udev->name);
        filename[NAME_SIZE-1] = '\0';
 
-       switch (udev->type) {
-       case 'b':
-               udev->mode |= S_IFBLK;
-               break;
-       case 'c':
-       case 'u':
-               udev->mode |= S_IFCHR;
-               break;
-       case 'p':
-               udev->mode |= S_IFIFO;
-               break;
-       default:
-               dbg("unknown node type %c\n", udev->type);
-               return -EINVAL;
-       }
-
        /* create parent directories if needed */
-       if (strrchr(udev->name, '/'))
+       if (strchr(udev->name, '/'))
                create_path(filename);
 
        if (udev->owner[0] != '\0') {