From 6ad623a3f77e087e308f334525fd4046811f2a9a Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 2 Nov 2015 23:57:21 +0100 Subject: 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. --- src/network/networkctl.c | 2 +- src/network/networkd-link-bus.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/network') diff --git a/src/network/networkctl.c b/src/network/networkctl.c index 97c1fe6560..ba7e3ba74a 100644 --- a/src/network/networkctl.c +++ b/src/network/networkctl.c @@ -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); diff --git a/src/network/networkd-link-bus.c b/src/network/networkd-link-bus.c index 7fc4510ac9..11b35d6cf8 100644 --- a/src/network/networkd-link-bus.c +++ b/src/network/networkd-link-bus.c @@ -103,7 +103,7 @@ int link_object_find(sd_bus *bus, const char *path, const char *interface, void if (r < 0) return 0; - r = safe_atoi(identifier, &ifindex); + r = parse_ifindex(identifier, &ifindex); if (r < 0) return 0; -- cgit v1.2.3-54-g00ecf