[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190607082517.5ebcceca@hermes.lan>
Date: Fri, 7 Jun 2019 08:25:17 -0700
From: Stephen Hemminger <stephen@...workplumber.org>
To: Matteo Croce <mcroce@...hat.com>
Cc: netdev@...r.kernel.org, Andrea Claudi <aclaudi@...hat.com>,
David Ahern <dsahern@...nel.org>,
"Eric W . Biederman" <ebiederm@...ssion.com>
Subject: Re: [PATCH iproute2] ip: reset netns after each command in batch
mode
On Fri, 7 Jun 2019 12:13:13 +0200
Matteo Croce <mcroce@...hat.com> wrote:
> +void netns_restore(void)
> +{
> + if (saved_netns != -1) {
If saved_netns is -1 then it is a program bug becase
no save was done? then do something?
> + if (!setns(saved_netns, CLONE_NEWNET)) {
> + close(saved_netns);
> + saved_netns = -1;
> + } else {
> + perror("setns");
If you are going to look for errors. then you need to either
return the error or cause the program to exit.
You don't want later commands in the batch to be applied
to wrong namespace.
Powered by blists - more mailing lists