Commit 08fbcd56 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Fix error handling of if_nametoindex.

parent 6e7c289b
......@@ -273,8 +273,8 @@ main(int argc, char **argv)
int mtu;
ifindex = if_nametoindex(*arg);
if(ifindex < 0) {
perror("if_nametoindex");
if(ifindex <= 0) {
fprintf(stderr, "Unknown interface %s.\n", *arg);
goto fail;
}
......
......@@ -212,7 +212,7 @@ kernel_route(int add, const unsigned char *dest, unsigned short plen,
if(ifindex_lo < 0) {
ifindex_lo = if_nametoindex("lo");
if(ifindex_lo < 0)
if(ifindex_lo <= 0)
return -1;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment