[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] udev: Don't let strtoul parse USB busnum and devnum as octal



On 02/01/2010 06:10 PM, Matthias Bolte wrote:
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.

This is a good change, but I thought it was already fixed a couple of weeks ago. You're sure they're returned decimal and not hex? ACK assuming that's the case.

Change udevProcessUSBDevice to use base 10 for busnum and devnum.
---
  src/node_device/node_device_udev.c |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index 734f3f7..0c0f29a 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -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;
      }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]