summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-device/device-enumerator.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-06-30 09:47:52 -0700
committerGitHub <noreply@github.com>2016-06-30 09:47:52 -0700
commit39231d7b62235592cafc6d86c6a1d49fc0219fe2 (patch)
treeb2b9b1c3686edc133b0c97ec172f701a42ec0b00 /src/libsystemd/sd-device/device-enumerator.c
parent34a8f0811c972aedd812468ae13bf9c18010c267 (diff)
parent21d6220fe0bf24fda7df9833961e022cafa439bc (diff)
Merge pull request #3608 from teg/sd-device-driver-id
sd-device: handle the 'drivers' pseudo-subsystem correctly
Diffstat (limited to 'src/libsystemd/sd-device/device-enumerator.c')
-rw-r--r--src/libsystemd/sd-device/device-enumerator.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/src/libsystemd/sd-device/device-enumerator.c b/src/libsystemd/sd-device/device-enumerator.c
index 4a7a8b1f9e..62d03ae00d 100644
--- a/src/libsystemd/sd-device/device-enumerator.c
+++ b/src/libsystemd/sd-device/device-enumerator.c
@@ -696,17 +696,19 @@ static int enumerator_scan_devices_tag(sd_device_enumerator *enumerator, const c
static int enumerator_scan_devices_tags(sd_device_enumerator *enumerator) {
const char *tag;
Iterator i;
- int r;
+ int r = 0;
assert(enumerator);
SET_FOREACH(tag, enumerator->match_tag, i) {
- r = enumerator_scan_devices_tag(enumerator, tag);
- if (r < 0)
- return r;
+ int k;
+
+ k = enumerator_scan_devices_tag(enumerator, tag);
+ if (k < 0)
+ r = k;
}
- return 0;
+ return r;
}
static int parent_add_child(sd_device_enumerator *enumerator, const char *path) {
@@ -838,7 +840,7 @@ static int enumerator_scan_devices_all(sd_device_enumerator *enumerator) {
int device_enumerator_scan_devices(sd_device_enumerator *enumerator) {
sd_device *device;
- int r;
+ int r = 0, k;
assert(enumerator);
@@ -850,22 +852,22 @@ int device_enumerator_scan_devices(sd_device_enumerator *enumerator) {
sd_device_unref(device);
if (!set_isempty(enumerator->match_tag)) {
- r = enumerator_scan_devices_tags(enumerator);
- if (r < 0)
- return r;
+ k = enumerator_scan_devices_tags(enumerator);
+ if (k < 0)
+ r = k;
} else if (enumerator->match_parent) {
- r = enumerator_scan_devices_children(enumerator);
- if (r < 0)
- return r;
+ k = enumerator_scan_devices_children(enumerator);
+ if (k < 0)
+ r = k;
} else {
- r = enumerator_scan_devices_all(enumerator);
- if (r < 0)
- return r;
+ k = enumerator_scan_devices_all(enumerator);
+ if (k < 0)
+ r = k;
}
enumerator->scan_uptodate = true;
- return 0;
+ return r;
}
_public_ sd_device *sd_device_enumerator_get_device_first(sd_device_enumerator *enumerator) {