network: set return value at the end of the function

The later netlink_call_async() call may fail. We should not touch the
return value when the function failed.
This commit is contained in:
Yu Watanabe
2021-02-12 22:43:10 +09:00
parent d9eee312a7
commit 0ef9f3c76f
+4 -5
View File
@@ -1077,6 +1077,7 @@ int route_configure(
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *req = NULL;
int r, k = 0;
Route *nr;
assert(link);
assert(link->manager);
@@ -1164,14 +1165,9 @@ int route_configure(
return log_link_error_errno(link, r, "Could not append RTA_MULTIPATH attribute: %m");
if (ordered_set_isempty(route->multipath_routes)) {
Route *nr;
k = route_add_and_setup_timer(link, route, NULL, &nr);
if (k < 0)
return k;
if (ret)
*ret = nr;
} else {
MultipathRoute *m;
@@ -1193,6 +1189,9 @@ int route_configure(
link_ref(link);
if (ret)
*ret = nr;
return k;
}