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 -3
View File
@@ -332,9 +332,7 @@ int machine_load(Machine *m) {
break;
}
if (safe_atoi(word, &ifi) < 0)
continue;
if (ifi <= 0)
if (parse_ifindex(word, &ifi) < 0)
continue;
if (!GREEDY_REALLOC(ni, allocated, nr+1)) {