aboutgitcodebugslistschat
path: root/conf.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 /conf.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 'conf.c')
-rw-r--r--conf.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/conf.c b/conf.c
index 80f4303..ea51de4 100644
--- a/conf.c
+++ b/conf.c
@@ -285,7 +285,7 @@ static void get_dns(struct ctx *c)
if (dns_set && dnss_set)
return;
- if ((fd = open("/etc/resolv.conf", O_RDONLY)) < 0)
+ if ((fd = open("/etc/resolv.conf", O_RDONLY | O_CLOEXEC)) < 0)
goto out;
while (!(*buf = 0) && line_read(buf, BUFSIZ, fd)) {
@@ -406,13 +406,17 @@ static int conf_ns_opt(struct ctx *c,
continue;
}
+ /* Don't pass O_CLOEXEC here: ns_enter() needs those files */
if (!c->netns_only) {
if (*conf_userns)
+ /* NOLINTNEXTLINE(android-cloexec-open) */
ufd = open(conf_userns, O_RDONLY);
else if (*userns)
+ /* NOLINTNEXTLINE(android-cloexec-open) */
ufd = open(userns, O_RDONLY);
}
+ /* NOLINTNEXTLINE(android-cloexec-open) */
nfd = open(netns, O_RDONLY);
if (nfd == -1 || (ufd == -1 && !c->netns_only)) {