mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-03-13 12:58:20 +03:00
udev: check return value of symlink
This commit is contained in:
parent
029f4f21fc
commit
6bb2f0a08a
@ -98,6 +98,7 @@ void udev_watch_begin(struct udev *udev, struct udev_device *dev)
|
||||
{
|
||||
char filename[UTIL_PATH_SIZE];
|
||||
int wd;
|
||||
int r;
|
||||
|
||||
if (inotify_fd < 0)
|
||||
return;
|
||||
@ -113,7 +114,9 @@ void udev_watch_begin(struct udev *udev, struct udev_device *dev)
|
||||
snprintf(filename, sizeof(filename), "/run/udev/watch/%d", wd);
|
||||
mkdir_parents(filename, 0755);
|
||||
unlink(filename);
|
||||
symlink(udev_device_get_id_filename(dev), filename);
|
||||
r = symlink(udev_device_get_id_filename(dev), filename);
|
||||
if (r < 0)
|
||||
log_error("Failed to create symlink: %m");
|
||||
|
||||
udev_device_set_watch_handle(dev, wd);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user