1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-25 06:03:40 +03:00

udev: try to create device symlink directly only when the link does not exist yet

This commit is contained in:
Yu Watanabe 2021-06-03 01:16:44 +09:00
parent 5802d4ea03
commit c891389a16

View File

@ -96,7 +96,7 @@ static int node_symlink(sd_device *dev, const char *node, const char *slink) {
return 0;
}
} else {
} else if (errno == ENOENT) {
log_device_debug(dev, "Creating symlink '%s' to '%s'", slink, target);
r = create_symlink(target, slink);
@ -104,7 +104,8 @@ static int node_symlink(sd_device *dev, const char *node, const char *slink) {
return 0;
log_device_debug_errno(dev, r, "Failed to create symlink '%s' to '%s', trying to replace '%s': %m", slink, target, slink);
}
} else
return log_device_debug_errno(dev, errno, "Failed to lstat() '%s': %m", slink);
log_device_debug(dev, "Atomically replace '%s'", slink);