lsusb-t: make sure that interfaces are added to lists only once (#914929)

This commit is contained in:
Lukas Nykryn 2013-02-26 15:03:01 +01:00
parent b0a0086593
commit 32eb76963e
2 changed files with 40 additions and 1 deletions

View File

@ -0,0 +1,34 @@
diff --git a/lsusb-t.c b/lsusb-t.c
index 074dafb..3e29072 100644
--- a/lsusb-t.c
+++ b/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;

View File

@ -1,6 +1,6 @@
Name: usbutils Name: usbutils
Version: 006 Version: 006
Release: 3%{?dist} Release: 4%{?dist}
Source: %{name}-%{version}.tar.gz Source: %{name}-%{version}.tar.gz
URL: http://www.linux-usb.org/ URL: http://www.linux-usb.org/
License: GPLv2+ License: GPLv2+
@ -14,6 +14,7 @@ Conflicts: hotplug < 3:2002_01_14-2
#Path to usb.ids in lsusb.py should be with /hwdata/ #Path to usb.ids in lsusb.py should be with /hwdata/
Patch0: usbutils-006-hwdata.patch Patch0: usbutils-006-hwdata.patch
Patch1: usbutils-006-lsub-t_loop.patch
%description %description
This package contains utilities for inspecting devices connected to a This package contains utilities for inspecting devices connected to a
@ -22,6 +23,7 @@ USB bus.
%prep %prep
%setup -q %setup -q
%patch0 -p1 %patch0 -p1
%patch1 -p1
./autogen.sh ./autogen.sh
%build %build
@ -43,6 +45,9 @@ make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p"
rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_ROOT
%changelog %changelog
* Tue Feb 26 2013 Lukáš Nykrýn <lnykryn@redhat.com> - 006-4
- lsusb-t: make sure that interfaces are added to lists only once (#914929)
* Fri Feb 15 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 006-3 * Fri Feb 15 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 006-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild