diff options
-rw-r--r-- | src/libudev/libudev-device.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/libudev/libudev-device.c b/src/libudev/libudev-device.c index acf8e24d15..d246d012b2 100644 --- a/src/libudev/libudev-device.c +++ b/src/libudev/libudev-device.c @@ -1358,16 +1358,17 @@ _public_ const char *udev_device_get_sysattr_value(struct udev_device *udev_devi goto out; } - /* resolve link to a device and return its syspath */ - util_strscpyl(path, sizeof(path), udev_device->syspath, "/", sysattr, NULL); - dev = udev_device_new_from_syspath(udev_device->udev, path); - if (dev != NULL) { - list_entry = udev_list_entry_add(&udev_device->sysattr_value_list, sysattr, - udev_device_get_syspath(dev)); - val = udev_list_entry_get_value(list_entry); - udev_device_unref(dev); + /* resolve custom link to a device and return its syspath */ + if (!streq(sysattr, "device")) { + util_strscpyl(path, sizeof(path), udev_device->syspath, "/", sysattr, NULL); + dev = udev_device_new_from_syspath(udev_device->udev, path); + if (dev != NULL) { + list_entry = udev_list_entry_add(&udev_device->sysattr_value_list, sysattr, + udev_device_get_syspath(dev)); + val = udev_list_entry_get_value(list_entry); + udev_device_unref(dev); + } } - goto out; } |