exp_target => "ttyUSB0",
rules => <<EOF
KERNEL=="ttyUSB[0-9]*", NAME="ttyUSB%n", SYMLINK="symlink1-%n symlink2-%k symlink3-%b"
+EOF
+ },
+ {
+ desc => "multiple symlinks with a lot of s p a c e s",
+ subsys => "tty",
+ devpath => "/class/tty/ttyUSB0",
+ exp_name => "one",
+ not_exp_name => " ",
+ exp_target => "ttyUSB0",
+ rules => <<EOF
+KERNEL=="ttyUSB[0-9]*", NAME="ttyUSB%n", SYMLINK=" one two "
EOF
},
{
/* add multiple symlinks separated by spaces */
pos = temp;
- next = strchr(temp, ' ');
+ while (isspace(pos[0]))
+ pos++;
+ next = strchr(pos, ' ');
while (next) {
next[0] = '\0';
info("add symlink '%s'", pos);
name_list_add(&udev->symlink_list, pos, 0);
+ while (isspace(next[1]))
+ next++;
pos = &next[1];
next = strchr(pos, ' ');
}
- info("add symlink '%s'", pos);
- name_list_add(&udev->symlink_list, pos, 0);
+ if (pos[0] != '\0') {
+ info("add symlink '%s'", pos);
+ name_list_add(&udev->symlink_list, pos, 0);
+ }
}
/* set name, later rules with name set will be ignored */