linux: linux_parent_dev search for . from the right
authorHans de Goede <hdegoede@redhat.com>
Thu, 16 May 2013 13:02:12 +0000 (15:02 +0200)
committerHans de Goede <hdegoede@redhat.com>
Thu, 16 May 2013 15:18:32 +0000 (17:18 +0200)
If hubs are chained to other hubs there will be multiple '.' characters, and
want the last one.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
libusb/os/linux_usbfs.c
libusb/version_nano.h

index 39e8b55..3ff5a9a 100644 (file)
@@ -1107,8 +1107,8 @@ static struct libusb_device *linux_parent_dev(struct libusb_context *ctx, const
        }
 
        parent_sysfs_dir = strdup(sysfs_dir);
-       if (NULL != (tmp = strchr(parent_sysfs_dir, '.')) ||
-           NULL != (tmp = strchr(parent_sysfs_dir, '-'))) {
+       if (NULL != (tmp = strrchr(parent_sysfs_dir, '.')) ||
+           NULL != (tmp = strrchr(parent_sysfs_dir, '-'))) {
                *tmp = '\0';
        } else {
                free (parent_sysfs_dir);
index 0d47cef..ddcceda 100644 (file)
@@ -1 +1 @@
-#define LIBUSB_NANO 10674
+#define LIBUSB_NANO 10675