summaryrefslogtreecommitdiff
path: root/src/bsd
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anytun.org>2009-01-20 14:40:00 +0000
committerChristian Pointner <equinox@anytun.org>2009-01-20 14:40:00 +0000
commit5c48bae63455253edb4607c2598e204c13ab5081 (patch)
treefd0364db2fde879295641b8c5636dd6bdc263c84 /src/bsd
parentimproved 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')
-rw-r--r--src/bsd/tunDevice.cpp8
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__)