summaryrefslogtreecommitdiff
path: root/dev.c
diff options
context:
space:
mode:
Diffstat (limited to 'dev.c')
-rw-r--r--dev.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/dev.c b/dev.c
index aa0ca4e..2b3a7a5 100644
--- a/dev.c
+++ b/dev.c
@@ -28,9 +28,10 @@ int device_ifindex_get(const char *ifname)
ret = ioctl(sock, SIOCGIFINDEX, &ifr);
if (ret)
- return -1;
+ index = -1;
+ else
+ index = ifr.ifr_ifindex;
- index = ifr.ifr_ifindex;
close(sock);
return index;