aboutgitcodebugslistschat
path: root/tap.c
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2022-03-27 13:10:26 +0200
committerStefano Brivio <sbrivio@redhat.com>2022-03-29 15:35:38 +0200
commit62c3edd9575cb7dfef0d86392e4b87a4c14d8dee (patch)
treea81a324ef38fdbb62c42f25dfa6cfdaec41480c0 /tap.c
parentad7f57a5b75ae62b48e5ff4f0c302f545dea2603 (diff)
downloadpasst-62c3edd9575cb7dfef0d86392e4b87a4c14d8dee.tar
passt-62c3edd9575cb7dfef0d86392e4b87a4c14d8dee.tar.gz
passt-62c3edd9575cb7dfef0d86392e4b87a4c14d8dee.tar.bz2
passt-62c3edd9575cb7dfef0d86392e4b87a4c14d8dee.tar.lz
passt-62c3edd9575cb7dfef0d86392e4b87a4c14d8dee.tar.xz
passt-62c3edd9575cb7dfef0d86392e4b87a4c14d8dee.tar.zst
passt-62c3edd9575cb7dfef0d86392e4b87a4c14d8dee.zip
treewide: Fix android-cloexec-* clang-tidy warnings, re-enable checks
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'tap.c')
-rw-r--r--tap.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/tap.c b/tap.c
index 8415d5a..6333015 100644
--- a/tap.c
+++ b/tap.c
@@ -875,12 +875,13 @@ static int tun_ns_fd = -1;
static int tap_ns_tun(void *arg)
{
struct ifreq ifr = { .ifr_flags = IFF_TAP | IFF_NO_PI };
+ int flags = O_RDWR | O_NONBLOCK | O_CLOEXEC;
struct ctx *c = (struct ctx *)arg;
strncpy(ifr.ifr_name, c->pasta_ifn, IFNAMSIZ);
if (ns_enter(c) ||
- (tun_ns_fd = open("/dev/net/tun", O_RDWR | O_NONBLOCK)) < 0 ||
+ (tun_ns_fd = open("/dev/net/tun", flags)) < 0 ||
ioctl(tun_ns_fd, TUNSETIFF, &ifr) ||
!(c->pasta_ifi = if_nametoindex(c->pasta_ifn)))
tun_ns_fd = -1;