diff options
Diffstat (limited to 'src/bsd/tunDevice.cpp')
-rw-r--r-- | src/bsd/tunDevice.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/bsd/tunDevice.cpp b/src/bsd/tunDevice.cpp index 421c1d5..3bbba35 100644 --- a/src/bsd/tunDevice.cpp +++ b/src/bsd/tunDevice.cpp @@ -124,13 +124,17 @@ void TunDevice::init_post() struct tuninfo ti; - if (ioctl(fd_, TUNGIFINFO, &ti) < 0) + if (ioctl(fd_, TUNGIFINFO, &ti) < 0) { + ::close(fd_); throw std::runtime_error("can't enable multicast for interface"); + } ti.flags |= IFF_MULTICAST; - if (ioctl(fd_, TUNSIFINFO, &ti) < 0) + if (ioctl(fd_, TUNSIFINFO, &ti) < 0) { + ::close(fd_); throw std::runtime_error("can't enable multicast for interface"); + } } #elif defined(__GNUC__) && defined(__FreeBSD__) |