parse-util: introduce parse_ifindex() and make use of it everywhere
We have enough places where we parse an ifindex, hence introduce a proper parsing function for it, that verifies all parameters.
This commit is contained in:
@@ -521,7 +521,7 @@ static int link_status_one(
|
||||
assert(rtnl);
|
||||
assert(name);
|
||||
|
||||
if (safe_atoi(name, &ifindex) >= 0 && ifindex > 0)
|
||||
if (parse_ifindex(name, &ifindex) >= 0)
|
||||
r = sd_rtnl_message_new_link(rtnl, &req, RTM_GETLINK, ifindex);
|
||||
else {
|
||||
r = sd_rtnl_message_new_link(rtnl, &req, RTM_GETLINK, 0);
|
||||
|
||||
Reference in New Issue
Block a user