diff options
Diffstat (limited to 'src/lib/eeze/eeze_udev_walk.c')
-rw-r--r-- | src/lib/eeze/eeze_udev_walk.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/lib/eeze/eeze_udev_walk.c b/src/lib/eeze/eeze_udev_walk.c index 4cd661b184..5df34178a8 100644 --- a/src/lib/eeze/eeze_udev_walk.c +++ b/src/lib/eeze/eeze_udev_walk.c @@ -40,7 +40,7 @@ EAPI const char * eeze_udev_walk_get_sysattr(const char *syspath, const char *sysattr) { - _udev_device *device, *child, *parent; + _udev_device *device, *parent; const char *test = NULL; if (!syspath) @@ -49,18 +49,12 @@ eeze_udev_walk_get_sysattr(const char *syspath, if (!(device = _new_device(syspath))) return NULL; - for (parent = device; parent;) + for (parent = device; parent && !test;) { - if ((test = udev_device_get_sysattr_value(parent, sysattr))) - { - test = eina_stringshare_add(test); - udev_device_unref(parent); - return test; - } - child = parent; - parent = udev_device_get_parent(child); - udev_device_unref(child); + test = udev_device_get_sysattr_value(parent, sysattr); + parent = udev_device_get_parent(parent); } - return NULL; + udev_device_unref(device); + return eina_stringshare_add(test); } |