]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
udev: Don't let strtoul parse USB busnum and devnum as octal
authorMatthias Bolte <matthias.bolte@googlemail.com>
Sat, 30 Jan 2010 23:53:40 +0000 (00:53 +0100)
committerMatthias Bolte <matthias.bolte@googlemail.com>
Tue, 2 Feb 2010 08:54:29 +0000 (09:54 +0100)
udevGetUintProperty was called with base set to 0 for busnum and devnum.
With base 0 strtoul parses the number as octal if it start with a 0. But
busnum and devnum are decimal and udev returns them padded with leading
zeros. So strtoul parses them as octal. This works for certain decimal
values like 001-007, but fails for values like 008.

Change udevProcessUSBDevice to use base 10 for busnum and devnum.

src/node_device/node_device_udev.c

index dcd889d95ff7343e32d03bf1f4c88c7bd74b73cf..2bc2d32a35abffeff480d1fe53b14e4c4d4cf497 100644 (file)
@@ -500,14 +500,14 @@ static int udevProcessUSBDevice(struct udev_device *device,
     if (udevGetUintProperty(device,
                             "BUSNUM",
                             &data->usb_dev.bus,
-                            0) == PROPERTY_ERROR) {
+                            10) == PROPERTY_ERROR) {
         goto out;
     }
 
     if (udevGetUintProperty(device,
                             "DEVNUM",
                             &data->usb_dev.device,
-                            0) == PROPERTY_ERROR) {
+                            10) == PROPERTY_ERROR) {
         goto out;
     }