]> err.no Git - systemd/commitdiff
libudev: fix sysnum logic for digit-only device names
authorAlan Jenkins <alan-jenkins@tuffmail.co.uk>
Fri, 17 Oct 2008 11:19:54 +0000 (13:19 +0200)
committerKay Sievers <kay.sievers@vrfy.org>
Fri, 17 Oct 2008 11:19:54 +0000 (13:19 +0200)
udev/lib/libudev-device.c

index 65ba6e30d83ef736389d413578e6877473a5e9bb..b5d42354e548d31c33f4304f6e35ef6049d362dd 100644 (file)
@@ -936,8 +936,13 @@ int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath
        }
 
        /* trailing number */
-       while (isdigit(udev_device->sysname[--len]))
+       while (len > 0 && isdigit(udev_device->sysname[--len]))
                udev_device->sysnum = &udev_device->sysname[len];
+
+       /* sysname is completely numeric */
+       if (len == 0)
+               udev_device->sysnum = NULL;
+
        return 0;
 }