diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-02-03 00:09:13 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-02-11 01:28:09 +0900 |
commit | d40b01e44b1bfc6af72284f722fff131d51ec349 (patch) | |
tree | 67e476d2f0bd1bdae02483d869a469eaeb22548e /src/network/networkd-route.c | |
parent | c606db69ab5d872c79046aa1632e38be6ac6d1db (diff) | |
download | systemd-d40b01e44b1bfc6af72284f722fff131d51ec349.tar.gz |
network: in_addr_is_null() may return negative errno
So, do not silently cast the returned value to boolean.
Exception is the case that family is trivially AF_INET or AF_INET6.
Diffstat (limited to 'src/network/networkd-route.c')
-rw-r--r-- | src/network/networkd-route.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c index 5553a7e3bd..6dd7a07c32 100644 --- a/src/network/networkd-route.c +++ b/src/network/networkd-route.c @@ -408,7 +408,7 @@ int route_remove(Route *route, Link *link, if (r < 0) return log_error_errno(r, "Could not create RTM_DELROUTE message: %m"); - if (!in_addr_is_null(route->family, &route->gw)) { + if (in_addr_is_null(route->family, &route->gw) == 0) { if (route->family == AF_INET) r = sd_netlink_message_append_in_addr(req, RTA_GATEWAY, &route->gw.in); else if (route->family == AF_INET6) @@ -443,7 +443,7 @@ int route_remove(Route *route, Link *link, return log_error_errno(r, "Could not set source prefix length: %m"); } - if (!in_addr_is_null(route->family, &route->prefsrc)) { + if (in_addr_is_null(route->family, &route->prefsrc) == 0) { if (route->family == AF_INET) r = sd_netlink_message_append_in_addr(req, RTA_PREFSRC, &route->prefsrc.in); else if (route->family == AF_INET6) @@ -519,7 +519,7 @@ int route_configure( if (r < 0) return log_error_errno(r, "Could not create RTM_NEWROUTE message: %m"); - if (!in_addr_is_null(route->family, &route->gw)) { + if (in_addr_is_null(route->family, &route->gw) == 0) { if (route->family == AF_INET) r = sd_netlink_message_append_in_addr(req, RTA_GATEWAY, &route->gw.in); else if (route->family == AF_INET6) @@ -558,7 +558,7 @@ int route_configure( return log_error_errno(r, "Could not set source prefix length: %m"); } - if (!in_addr_is_null(route->family, &route->prefsrc)) { + if (in_addr_is_null(route->family, &route->prefsrc) == 0) { if (route->family == AF_INET) r = sd_netlink_message_append_in_addr(req, RTA_PREFSRC, &route->prefsrc.in); else if (route->family == AF_INET6) |