From 8c30f20b7e3b125e52e66a602fc97cef5364a7d1 Mon Sep 17 00:00:00 2001 From: illiliti Date: Fri, 31 Jul 2020 21:30:38 +0300 Subject: [PATCH] change logic --- udev_device.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/udev_device.c b/udev_device.c index 440ac6f..0063792 100644 --- a/udev_device.c +++ b/udev_device.c @@ -123,15 +123,13 @@ struct udev_device *udev_device_get_parent(struct udev_device *udev_device) return NULL; } - syspath = path = strdup(udev_device_get_syspath(udev_device)); + syspath = strdup(udev_device_get_syspath(udev_device)); - if (!path) { + if (!syspath) { return NULL; } - if (strncmp(path, "/sys/devices/", 13) == 0) { - path += 13; - } + path = syspath + 5; do { if ((path = strrchr(path, '/'))) {