summaryrefslogtreecommitdiff
path: root/src/network/networkd-manager.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/networkd-manager.c')
-rw-r--r--src/network/networkd-manager.c29
1 files changed, 11 insertions, 18 deletions
diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c
index 724e5e5a47..6998562dc0 100644
--- a/src/network/networkd-manager.c
+++ b/src/network/networkd-manager.c
@@ -157,48 +157,41 @@ static int manager_process_link(Manager *m, struct udev_device *device) {
}
int manager_udev_enumerate_links(Manager *m) {
+ _cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL;
struct udev_list_entry *item = NULL, *first = NULL;
- struct udev_enumerate *e;
int r;
assert(m);
e = udev_enumerate_new(m->udev);
- if (!e) {
- r = -ENOMEM;
- goto finish;
- }
+ if (!e)
+ return -ENOMEM;
r = udev_enumerate_add_match_subsystem(e, "net");
if (r < 0)
- goto finish;
+ return r;
r = udev_enumerate_scan_devices(e);
if (r < 0)
- goto finish;
+ return r;
first = udev_enumerate_get_list_entry(e);
udev_list_entry_foreach(item, first) {
- struct udev_device *d;
+ _cleanup_udev_device_unref_ struct udev_device *d = NULL;
int k;
d = udev_device_new_from_syspath(m->udev, udev_list_entry_get_name(item));
- if (!d) {
- r = -ENOMEM;
- goto finish;
- }
+ if (!d)
+ return -ENOMEM;
- k = manager_process_link(m, d);
- udev_device_unref(d);
+ if (!udev_device_get_is_initialized(d))
+ continue;
+ k = manager_process_link(m, d);
if (k < 0)
r = k;
}
-finish:
- if (e)
- udev_enumerate_unref(e);
-
return r;
}