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:
Lennart Poettering
2015-11-03 00:02:00 +01:00
parent 6a37c68469
commit 6ad623a3f7
8 changed files with 22 additions and 18 deletions
+1 -1
View File
@@ -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);