diff options
Diffstat (limited to 'udev_add.c')
-rw-r--r-- | udev_add.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/udev_add.c b/udev_add.c index e5bd042a5c..eeab1ca174 100644 --- a/udev_add.c +++ b/udev_add.c @@ -83,7 +83,6 @@ create: selinux_setfscreatecon(file, udev->kernel_name, mode); retval = mknod(file, mode, devt); - selinux_resetfscreatecon(); if (retval != 0) { dbg("mknod(%s, %#o, %u, %u) failed with error '%s'", file, mode, major(devt), minor(devt), strerror(errno)); @@ -197,7 +196,6 @@ static int create_node(struct udevice *udev, struct sysfs_class_device *class_de /* create symlink(s) if requested */ foreach_strpart(udev->symlink, " ", pos, len) { - int retval; char linkname[NAME_SIZE]; char linktarget[NAME_SIZE]; @@ -229,11 +227,9 @@ static int create_node(struct udevice *udev, struct sysfs_class_device *class_de dbg("symlink(%s, %s)", linktarget, filename); if (!udev->test_run) { - unlink(filename); selinux_setfscreatecon(filename, udev->kernel_name, S_IFLNK); - retval = symlink(linktarget, filename); - selinux_resetfscreatecon(); - if (retval != 0) + unlink(filename); + if (symlink(linktarget, filename) != 0) dbg("symlink(%s, %s) failed with error '%s'", linktarget, filename, strerror(errno)); } @@ -330,7 +326,7 @@ int udev_add_device(struct udevice *udev, struct sysfs_class_device *class_dev) } exit: - selinux_exit(); + selinux_restore(); return retval; } |