conf: Reset netns_only flag after probing

...if we check whether an option might be a namespace specification,
and it turns out not to be (e.g. with --pcap), we might set
netns_only, but we don't reset it back to 0 if it wasn't set.

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
Stefano Brivio 2021-10-14 12:12:33 +02:00
parent c61944a1f8
commit 1cbd2c8c6b

4
conf.c
View file

@ -369,8 +369,8 @@ static int conf_ns_check(void *arg)
static int conf_ns_opt(struct ctx *c, static int conf_ns_opt(struct ctx *c,
char *nsdir, char *conf_userns, const char *optarg) char *nsdir, char *conf_userns, const char *optarg)
{ {
int ufd = 0, nfd = 0, try, ret, netns_only_reset = c->netns_only;
char userns[PATH_MAX], netns[PATH_MAX]; char userns[PATH_MAX], netns[PATH_MAX];
int ufd = 0, nfd = 0, try, ret;
char *endptr; char *endptr;
pid_t pid; pid_t pid;
@ -434,6 +434,8 @@ static int conf_ns_opt(struct ctx *c,
close(ufd); close(ufd);
} }
c->netns_only = netns_only_reset;
return -ENOENT; return -ENOENT;
} }