- dbg("checking major/minor of device node '%s'", filename);
- if (stat(filename, &stats) != 0)
- return -1;
+ list_for_each_entry(name_loop, &udev->symlink_list, node) {
+ snprintf(filename, sizeof(filename), "%s/%s", udev_root, name_loop->name);
+ filename[sizeof(filename)-1] = '\0';
+
+ if (stat(filename, &stats) != 0) {
+ dbg("symlink '%s' not found", filename);
+ continue;
+ }
+ if (udev->devt && stats.st_rdev != udev->devt) {
+ info("symlink '%s' points to a different device, skip removal", filename);
+ continue;
+ }
+
+ info("removing symlink '%s'", filename);
+ unlink(filename);
+
+ if (strchr(filename, '/'))
+ delete_path(filename);
+
+ strlcat(symlinks, filename, sizeof(symlinks));
+ strlcat(symlinks, " ", sizeof(symlinks));
+ }
+
+ remove_trailing_chars(symlinks, ' ');
+ if (symlinks[0] != '\0')
+ setenv("DEVLINKS", symlinks, 1);
+ }