[libvirt] [PATCH] hostusb: Properly handle 'usbX' sysfs files

Laine Stump laine at laine.org
Tue Jun 1 19:48:34 UTC 2010


On 06/01/2010 03:10 PM, Cole Robinson wrote:
> 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.
>
> Signed-off-by: Cole Robinson<crobinso at redhat.com>
> ---
>   src/util/hostusb.c |    2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/src/util/hostusb.c b/src/util/hostusb.c
> index 78b601f..2d6e414 100644
> --- a/src/util/hostusb.c
> +++ b/src/util/hostusb.c
> @@ -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) {
>    

ACK. (How did this not show up before? All of my machines show 
/sys/bus/usb/devices/usbX, not plain "usb" - definitely this is the 
correct comparison.)




More information about the libvir-list mailing list