- if (dev->symlink[0] != '\0') {
- symlinks = dev->symlink;
- while (1) {
- linkname = strsep(&symlinks, " ");
- if (linkname == NULL || linkname[0] == '\0')
- break;
-
- strncpy(filename, udev_root, sizeof(filename));
- strncat(filename, linkname, sizeof(filename));
- dbg("symlink '%s' to node '%s' requested", filename, dev->name);
- if (!fake)
- if (strrchr(linkname, '/'))
- create_path(filename);
-
- /* optimize relative link */
- linktarget[0] = '\0';
- i = 0;
- tail = 0;
- while ((dev->name[i] == linkname[i]) && dev->name[i]) {
- if (dev->name[i] == '/')
- tail = i+1;
- i++;
- }
- while (linkname[i] != '\0') {
- if (linkname[i] == '/')
- strcat(linktarget, "../");
- i++;
- }
+ foreach_strpart(dev->symlink, " ", pos, len) {
+ strnfieldcpy(linkname, pos, len+1);
+ strfieldcpy(filename, udev_root);
+ strfieldcat(filename, linkname);
+ dbg("symlink '%s' to node '%s' requested", filename, dev->name);
+ if (!fake)
+ if (strrchr(linkname, '/'))
+ create_path(filename);
+
+ /* optimize relative link */
+ linktarget[0] = '\0';
+ i = 0;
+ tail = 0;
+ while ((dev->name[i] == linkname[i]) && dev->name[i]) {
+ if (dev->name[i] == '/')
+ tail = i+1;
+ i++;
+ }
+ while (linkname[i] != '\0') {
+ if (linkname[i] == '/')
+ strfieldcat(linktarget, "../");
+ i++;
+ }