summaryrefslogtreecommitdiff
path: root/udev_add.c
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 /udev_add.c
parentf22e9686fd4f8e602e8dc11a4b06765206f26edf (diff)
[PATCH] fix special file mode mask for temporary device node
Diffstat (limited to 'udev_add.c')
-rw-r--r--udev_add.c34
1 files changed, 17 insertions, 17 deletions
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') {