diff options
Diffstat (limited to 'src/resolve-host/resolve-host.c')
-rw-r--r-- | src/resolve-host/resolve-host.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/resolve-host/resolve-host.c b/src/resolve-host/resolve-host.c index 97516a87a8..432e62dd9f 100644 --- a/src/resolve-host/resolve-host.c +++ b/src/resolve-host/resolve-host.c @@ -25,9 +25,11 @@ #include "sd-bus.h" #include "af-list.h" +#include "alloc-util.h" #include "bus-error.h" #include "bus-util.h" #include "in-addr-util.h" +#include "parse-util.h" #include "resolved-def.h" #include "resolved-dns-packet.h" @@ -298,8 +300,7 @@ static int parse_address(const char *s, int *family, union in_addr_union *addres percent = strchr(s, '%'); if (percent) { - r = safe_atoi(percent+1, &ifi); - if (r < 0 || ifi <= 0) { + if (parse_ifindex(percent+1, &ifi) < 0) { ifi = if_nametoindex(percent+1); if (ifi <= 0) return -EINVAL; @@ -519,7 +520,7 @@ static int parse_argv(int argc, char *argv[]) { case 'i': { int ifi; - if (safe_atoi(optarg, &ifi) >= 0 && ifi > 0) + if (parse_ifindex(optarg, &ifi) >= 0) arg_ifindex = ifi; else { ifi = if_nametoindex(optarg); |