summaryrefslogtreecommitdiff
path: root/udev/lib
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2009-03-18 18:42:16 +0100
committerKay Sievers <kay.sievers@vrfy.org>2009-03-18 18:42:16 +0100
commitf454f6708a1ca439dbe9abd6b9fb660423a71d14 (patch)
tree83a343121fa293f7bfa0f272ce6e7c2b28ed74fe /udev/lib
parentb25d8cfa93c93fb2b98fdd747777294c787c6619 (diff)
udevadm: test - handling trailing '/' in devpath
On Wed, Mar 18, 2009 at 16:00, Matthias Schwarzott <zzam@gentoo.org> wrote: found out how the error occurs: It is a difference between A. udevadm test /sys/class/mem/null/ and B. udevadm test /sys/class/mem/null Case A was the case that showed the error behaviour. It seems udevadm is confused by the trailing slash. This behaviour seems to be there since ages.
Diffstat (limited to 'udev/lib')
-rw-r--r--udev/lib/libudev-device.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c
index 1a9d0a1e69..e13cbe554b 100644
--- a/udev/lib/libudev-device.c
+++ b/udev/lib/libudev-device.c
@@ -303,7 +303,7 @@ struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *
/* path is not a root directory */
subdir = &syspath[len+1];
pos = strrchr(subdir, '/');
- if (pos == NULL || pos < &subdir[2]) {
+ if (pos == NULL || pos[1] == '\0' || pos < &subdir[2]) {
dbg(udev, "not a subdir :%s\n", syspath);
return NULL;
}