diff options
author | kay.sievers@vrfy.org <kay.sievers@vrfy.org> | 2005-03-05 05:35:31 +0100 |
---|---|---|
committer | Greg KH <gregkh@suse.de> | 2005-04-26 23:48:48 -0700 |
commit | e48fc108d9731f6f091742fe6588c495d1948fac (patch) | |
tree | 61ae26907421a39be1205de59b9594f0134e3d04 /udev_add.c | |
parent | 7eb92135c61af77fff62eec5f396b9633a54b245 (diff) |
[PATCH] allow unlimitied count of symlinks
Diffstat (limited to 'udev_add.c')
-rw-r--r-- | udev_add.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/udev_add.c b/udev_add.c index eeab1ca174..7e0c57fc63 100644 --- a/udev_add.c +++ b/udev_add.c @@ -113,12 +113,11 @@ static int create_node(struct udevice *udev, struct sysfs_class_device *class_de { char filename[NAME_SIZE]; char partitionname[NAME_SIZE]; + struct name_entry *name_loop; uid_t uid = 0; gid_t gid = 0; int tail; - char *pos; - int len; - int i; + int i; snprintf(filename, NAME_SIZE, "%s/%s", udev_root, udev->name); filename[NAME_SIZE-1] = '\0'; @@ -195,30 +194,28 @@ static int create_node(struct udevice *udev, struct sysfs_class_device *class_de } /* create symlink(s) if requested */ - foreach_strpart(udev->symlink, " ", pos, len) { - char linkname[NAME_SIZE]; + list_for_each_entry(name_loop, &udev->symlink_list, node) { char linktarget[NAME_SIZE]; - strfieldcpymax(linkname, pos, len+1); - snprintf(filename, NAME_SIZE, "%s/%s", udev_root, linkname); + snprintf(filename, NAME_SIZE, "%s/%s", udev_root, name_loop->name); filename[NAME_SIZE-1] = '\0'; dbg("symlink '%s' to node '%s' requested", filename, udev->name); if (!udev->test_run) - if (strrchr(linkname, '/')) + if (strchr(filename, '/')) create_path(filename); /* optimize relative link */ linktarget[0] = '\0'; i = 0; tail = 0; - while ((udev->name[i] == linkname[i]) && udev->name[i]) { + while (udev->name[i] && (udev->name[i] == name_loop->name[i])) { if (udev->name[i] == '/') tail = i+1; i++; } - while (linkname[i] != '\0') { - if (linkname[i] == '/') + while (name_loop->name[i] != '\0') { + if (name_loop->name[i] == '/') strfieldcat(linktarget, "../"); i++; } |