]> xenbits.xensource.com Git - libvirt.git/commitdiff
hostusb: Properly handle 'usbX' sysfs files
authorCole Robinson <crobinso@redhat.com>
Tue, 1 Jun 2010 18:46:26 +0000 (14:46 -0400)
committerCole Robinson <crobinso@redhat.com>
Wed, 2 Jun 2010 13:57:55 +0000 (09:57 -0400)
Fedora bug https://bugzilla.redhat.com/show_bug.cgi?id=598272

Some files under /sys/bus/usb/devices/ have the format 'usbX', where
X is the USB bus number. Use STRPREFIX to correctly parse the bus numbers.

src/util/hostusb.c

index 78b601f4700dee25947f0836b42a573ea08ef115..2d6e41482a9bd7792634d849eeb5e0319dde412e 100644 (file)
@@ -121,7 +121,7 @@ static int usbFindBusByVendor(unsigned vendor, unsigned product,
             char *tmpstr = de->d_name;
             unsigned found_bus, found_addr;
 
-            if (STREQ(de->d_name, "usb"))
+            if (STRPREFIX(de->d_name, "usb"))
                 tmpstr += 3;
 
             if (virStrToLong_ui(tmpstr, &ignore, 10, &found_bus) < 0) {