summaryrefslogtreecommitdiff
path: root/libudev/libudev-device-private.c
diff options
context:
space:
mode:
Diffstat (limited to 'libudev/libudev-device-private.c')
-rw-r--r--libudev/libudev-device-private.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libudev/libudev-device-private.c b/libudev/libudev-device-private.c
index bf93834c10..430e3e64d4 100644
--- a/libudev/libudev-device-private.c
+++ b/libudev/libudev-device-private.c
@@ -34,8 +34,12 @@ static void udev_device_tag(struct udev_device *dev, const char *tag, bool add)
util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/tags/", tag, "/", id, NULL);
if (add) {
+ int fd;
+
util_create_path(udev, filename);
- symlink(udev_device_get_devpath(dev), filename);
+ fd = open(filename, O_WRONLY|O_CREAT|O_CLOEXEC|O_TRUNC|O_NOFOLLOW, 0444);
+ if (fd >= 0)
+ close(fd);
} else {
unlink(filename);
}