diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-12-18 03:37:26 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-12-18 03:37:26 +0100 |
commit | bf5332d2bf2a1acbba9daacf40570a4addbd3411 (patch) | |
tree | 3408c022c8b2cdb70c994d28a95de7aa4d252db4 /src/network | |
parent | 5e2f14e62b43f713bade20dd9f55db525ac43859 (diff) |
core,logind,networkd: don't pick up devices from udev before they finished udev initialization
Managers shouldn't pick up the devices the manage before udev finished
initialization, hence check explicitly for that.
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/networkd-manager.c | 29 |
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; } |