From: Yu Watanabe Date: Wed, 3 Feb 2021 15:44:03 +0000 (+0900) Subject: network: set return value at the end of the function X-Git-Tag: v248-rc1~147^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0ef9f3c76ff37a0ea7d2c44ad7c659d1e8d052f1;p=thirdparty%2Fsystemd.git 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. --- diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c index 5a908dbeb0f..e4618453518 100644 --- a/src/network/networkd-route.c +++ b/src/network/networkd-route.c @@ -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; }