summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>2005-02-10 19:46:50 +0100
committerGreg KH <gregkh@suse.de>2005-04-26 23:33:50 -0700
commit6a24dc747788b6049ef35607ff252e3965af2ce5 (patch)
treed7d4ab1db9089bd2a1838907ab981f829f509828
parentf22e9686fd4f8e602e8dc11a4b06765206f26edf (diff)
[PATCH] fix special file mode mask for temporary device node
-rw-r--r--test/udev-test.pl2
-rw-r--r--udev_add.c34
2 files changed, 18 insertions, 18 deletions
diff --git a/test/udev-test.pl b/test/udev-test.pl
index 992fc0019a..1b1ee90922 100644
--- a/test/udev-test.pl
+++ b/test/udev-test.pl
@@ -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
},
{
diff --git a/udev_add.c b/udev_add.c
index c566571c1c..be62e130ab 100644
--- a/udev_add.c
+++ b/udev_add.c
@@ -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') {