summaryrefslogtreecommitdiff
path: root/node
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2014-04-09 15:22:08 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2014-04-09 15:22:08 -0700
commit6c5f6feb5ebd4e92d9b7f49eb50e05b3b7d01441 (patch)
tree2441e2782b5bf991e2ac676b5113a36a26206652 /node
parenta1c1c82b0d600c2efdb2afb7d73a4914c856cce1 (diff)
downloadinfinitytier-6c5f6feb5ebd4e92d9b7f49eb50e05b3b7d01441.tar.gz
infinitytier-6c5f6feb5ebd4e92d9b7f49eb50e05b3b7d01441.zip
Set close-on-exec in attempt to head off GitHub issue #61
Diffstat (limited to 'node')
-rw-r--r--node/UnixEthernetTap.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/node/UnixEthernetTap.cpp b/node/UnixEthernetTap.cpp
index 50f1dcc5..240efe41 100644
--- a/node/UnixEthernetTap.cpp
+++ b/node/UnixEthernetTap.cpp
@@ -308,6 +308,9 @@ UnixEthernetTap::UnixEthernetTap(
::close(sock);
+ // Set close-on-exec so that devices cannot persist if we fork/exec for update
+ fcntl(_fd,F_SETFD,fcntl(_fd,F_GETFD) | FD_CLOEXEC);
+
::pipe(_shutdownSignalPipe);
TRACE("tap %s created",_dev.c_str());
@@ -418,6 +421,9 @@ UnixEthernetTap::UnixEthernetTap(
_setIpv6Stuff(_dev.c_str(),true,false);
+ // Set close-on-exec so that devices cannot persist if we fork/exec for update
+ fcntl(_fd,F_SETFD,fcntl(_fd,F_GETFD) | FD_CLOEXEC);
+
::pipe(_shutdownSignalPipe);
_thread = Thread::start(this);