+ /* collect symlinks */
+ if (dev->symlink[0] != '\0') {
+ char temp[PATH_SIZE];
+ char *pos, *next;
+
+ info("configured rule in '%s[%i]' applied, added symlink '%s'",
+ dev->config_file, dev->config_line, dev->symlink);
+ strlcpy(temp, dev->symlink, sizeof(temp));
+ apply_format(udev, temp, sizeof(temp), class_dev, sysfs_device);
+
+ /* add multiple symlinks separated by spaces */
+ pos = temp;
+ next = strchr(temp, ' ');
+ while (next) {
+ next[0] = '\0';
+ dbg("add symlink '%s'", pos);
+ name_list_add(&udev->symlink_list, pos, 0);
+ pos = &next[1];
+ next = strchr(pos, ' ');
+ }
+ dbg("add symlink '%s'", pos);
+ name_list_add(&udev->symlink_list, pos, 0);
+ }
+
+ /* rule matches */
+ if (dev->name[0] != '\0') {
+ info("configured rule in '%s[%i]' applied, '%s' becomes '%s'",
+ dev->config_file, dev->config_line, udev->kernel_name, dev->name);
+
+ strlcpy(udev->name, dev->name, sizeof(udev->name));
+ apply_format(udev, udev->name, sizeof(udev->name), class_dev, sysfs_device);
+ strlcpy(udev->config_file, dev->config_file, sizeof(udev->config_file));
+ udev->config_line = dev->config_line;
+
+ if (udev->type != NET)
+ dbg("name, '%s' is going to have owner='%s', group='%s', mode=%#o partitions=%i",
+ udev->name, udev->owner, udev->group, udev->mode, udev->partitions);
+
+ break;
+ }
+ }
+ }
+
+ if (udev->name[0] == '\0') {
+ /* no rule matched, so we use the kernel name */
+ strlcpy(udev->name, udev->kernel_name, sizeof(udev->name));
+ dbg("no rule found, use kernel name '%s'", udev->name);
+ }
+
+ if (udev->tmp_node[0] != '\0') {
+ dbg("removing temporary device node");
+ unlink_secure(udev->tmp_node);
+ udev->tmp_node[0] = '\0';
+ }
+
+ return 0;