aboutsummaryrefslogtreecommitdiffstats
path: root/vnet/vnet/unix/tuntap.c
diff options
context:
space:
mode:
Diffstat (limited to 'vnet/vnet/unix/tuntap.c')
-rw-r--r--vnet/vnet/unix/tuntap.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/vnet/vnet/unix/tuntap.c b/vnet/vnet/unix/tuntap.c
index 28b2584b3d3..f24d71eee8a 100644
--- a/vnet/vnet/unix/tuntap.c
+++ b/vnet/vnet/unix/tuntap.c
@@ -427,7 +427,8 @@ tuntap_exit (vlib_main_t * vm)
if (ioctl (tm->dev_net_tun_fd, TUNSETPERSIST, 0) < 0)
clib_unix_warning ("TUNSETPERSIST");
close(tm->dev_tap_fd);
- close(tm->dev_net_tun_fd);
+ if (tm->dev_net_tun_fd >= 0)
+ close(tm->dev_net_tun_fd);
close (sfd);
return 0;
@@ -809,7 +810,8 @@ tuntap_ip6_add_del_interface_address (ip6_main_t * im,
if (ioctl (sockfd, SIOCDIFADDR, &ifr6) < 0)
clib_unix_warning ("del address");
- close (sockfd);
+ if (sockfd >= 0)
+ close (sockfd);
mhash_unset (&tm->subif_mhash, &subif_addr, 0 /* old value ptr */);
pool_put (tm->subifs, ap);