Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #15 from lnykryn/master

lsusb-t: make sure that interfaces are added to lists only once
  • Loading branch information...
commit 3d281975c7261f1601c22f1b88fab9b94c80889b 2 parents b87a6ca + f16b319
@gregkh authored
Showing with 12 additions and 2 deletions.
  1. +12 −2 lsusb-t.c
View
14 lsusb-t.c
@@ -210,8 +210,13 @@ static void read_sysfs_file_string(const char *d_name, const char *file, char *b
static void append_dev_interface(struct usbinterface *i, struct usbinterface *new)
{
- while (i->next)
+ while (i->next) {
+ if (i == new)
+ return;
i = i->next;
+ }
+ if (i == new)
+ return;
i->next = new;
}
@@ -230,8 +235,13 @@ static void append_businterface(unsigned int busnum, struct usbinterface *new)
if (b->busnum == busnum) {
i = b->first_interface;
if (i) {
- while (i->next)
+ while (i->next) {
+ if (i == new)
+ return;
i = i->next;
+ }
+ if (i == new)
+ return;
i->next = new;
} else
b->first_interface = new;
Please sign in to comment.
Something went wrong with that request. Please try again.