diff options
author | Christian Pointner <equinox@anytun.org> | 2009-01-20 14:40:00 +0000 |
---|---|---|
committer | Christian Pointner <equinox@anytun.org> | 2009-01-20 14:40:00 +0000 |
commit | 5c48bae63455253edb4607c2598e204c13ab5081 (patch) | |
tree | fd0364db2fde879295641b8c5636dd6bdc263c84 /src/bsd/tunDevice.cpp | |
parent | improved esit status handling of exec script for unix (diff) |
fixed linux and bsd tunDevice (filedescriptor gets now closed in case of an exception during object construction)
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__) |