summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Jenkins <alan-jenkins@tuffmail.co.uk>2008-10-17 13:19:54 +0200
committerKay Sievers <kay.sievers@vrfy.org>2008-10-17 13:19:54 +0200
commitbabcf3cb22af24725030ad795f2e41d024afced3 (patch)
tree37aed97ffac5f68ff2381b38afeafb6bd3e200de
parent3feeb77c97a62cbb714bb95ed38ec8c44cb459ce (diff)
libudev: fix sysnum logic for digit-only device names
-rw-r--r--udev/lib/libudev-device.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c
index 65ba6e30d8..b5d42354e5 100644
--- a/udev/lib/libudev-device.c
+++ b/udev/lib/libudev-device.c
@@ -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;
}