summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2015-10-09 17:21:15 +0200
committerTom Gundersen <teg@jklm.no>2015-10-11 15:04:16 +0200
commit5c416fc40818ee271c4ae89909e7780382aa39bb (patch)
treee671cb8fd89fe8d8f0f3f9df5527ef4ea5e48330
parent87e4c847f63ba138fa9cc5047a00d2c80b6f0d1f (diff)
networkd: link - fix error handling in link_add()
-rw-r--r--src/network/networkd-link.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 1374f44112..eebefda2e1 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -2207,8 +2207,10 @@ int link_add(Manager *m, sd_netlink_message *message, Link **ret) {
/* not in a container, udev will be around */
sprintf(ifindex_str, "n%d", link->ifindex);
device = udev_device_new_from_device_id(m->udev, ifindex_str);
- if (!device)
- return log_link_warning_errno(link, errno, "Could not find udev device: %m");
+ if (!device) {
+ r = log_link_warning_errno(link, errno, "Could not find udev device: %m");
+ goto failed;
+ }
if (udev_device_get_is_initialized(device) <= 0) {
/* not yet ready */
@@ -2218,17 +2220,20 @@ int link_add(Manager *m, sd_netlink_message *message, Link **ret) {
r = link_initialized(link, device);
if (r < 0)
- return r;
+ goto failed;
} else {
/* we are calling a callback directly, so must take a ref */
link_ref(link);
r = link_initialized_and_synced(m->rtnl, NULL, link);
if (r < 0)
- return r;
+ goto failed;
}
return 0;
+failed:
+ link_enter_failed(link);
+ return r;
}
static int link_carrier_gained(Link *link) {