From 5282e06fd4d021c57a5ad770581fb611de517ae7 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Mon, 16 Nov 2020 19:08:09 -0500 Subject: [PATCH] Tun/tap flags fix. --- osdep/LinuxEthernetTap.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osdep/LinuxEthernetTap.cpp b/osdep/LinuxEthernetTap.cpp index 89caccf57..ebd295a80 100644 --- a/osdep/LinuxEthernetTap.cpp +++ b/osdep/LinuxEthernetTap.cpp @@ -174,7 +174,6 @@ LinuxEthernetTap::LinuxEthernetTap( ::ioctl(_fd,TUNSETPERSIST,0); // valgrind may generate a false alarm here _dev = ifr.ifr_name; ::fcntl(_fd,F_SETFD,fcntl(_fd,F_GETFD) | FD_CLOEXEC); - ::fcntl(_fd,F_SETFL,O_NONBLOCK); (void)::pipe(_shutdownSignalPipe); @@ -450,7 +449,7 @@ void LinuxEthernetTap::threadMain() return; } - if (fcntl(_fd,F_SETFL,fcntl(_fd,F_GETFL) & ~O_NONBLOCK) == -1) { + if (fcntl(_fd,F_SETFL,O_NONBLOCK) == -1) { ::close(sock); printf("WARNING: ioctl() failed setting up Linux tap device (set non-blocking)\n"); return;