Commit 992a1def authored by Jiri Popelka's avatar Jiri Popelka

iptunnel.c: avoid fd leak in case of ioctl() error

parent 53c40178
......@@ -106,6 +106,7 @@ static int do_ioctl_get_ifindex(char *dev)
err = ioctl(fd, SIOCGIFINDEX, &ifr);
if (err) {
perror("ioctl");
close(fd);
return 0;
}
close(fd);
......@@ -123,6 +124,7 @@ static int do_ioctl_get_iftype(char *dev)
err = ioctl(fd, SIOCGIFHWADDR, &ifr);
if (err) {
perror("ioctl");
close(fd);
return -1;
}
close(fd);
......@@ -141,6 +143,7 @@ static char * do_ioctl_get_ifname(int idx)
err = ioctl(fd, SIOCGIFNAME, &ifr);
if (err) {
perror("ioctl");
close(fd);
return NULL;
}
close(fd);
......
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