[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1373393602.2523.4.camel@bwh-desktop.uk.level5networks.com>
Date: Tue, 9 Jul 2013 19:13:22 +0100
From: Ben Hutchings <bhutchings@...arflare.com>
To: <nicolas.dichtel@...nd.com>
CC: <eric.dumazet@...il.com>, <shemminger@...tta.com>,
<netdev@...r.kernel.org>, <junwei.zhang@...nd.com>
Subject: Re: [PATCH iproute2 v4] ipbatch: fix use of 'ip netns exec'
On Tue, 2013-07-09 at 18:59 +0200, Nicolas Dichtel wrote:
> Le 09/07/2013 18:19, Ben Hutchings a écrit :
> > On Tue, 2013-07-09 at 17:55 +0200, Nicolas Dichtel wrote:
> > [...]
> >> diff --git a/ip/ipnetns.c b/ip/ipnetns.c
> >> index fa2b681..cdc3101 100644
> >> --- a/ip/ipnetns.c
> >> +++ b/ip/ipnetns.c
> >> @@ -42,6 +42,7 @@
> >> #define MS_SHARED (1 << 20)
> >> #endif
> >>
> >> +extern char *batch_file;
> I let Stephen choose, he suggest me this.
>
> >
> > Should be declared in a header file.
> >
> >> #ifndef HAVE_SETNS
> >> static int setns(int fd, int nstype)
> >> @@ -185,6 +186,42 @@ static int netns_exec(int argc, char **argv)
> >> /* Setup bind mounts for config files in /etc */
> >> bind_etc(name);
> >>
> >> + if (batch_file) {
> >> + int status;
> >> + pid_t pid;
> >> +
> >> + pid = fork();
> >> + if (pid < 0) {
> >> + perror("fork");
> >> + return EXIT_FAILURE;
> >
> > return -1;
> man exit says:
> The use of EXIT_SUCCESS and EXIT_FAILURE is slightly more portable (to non-UNIX
> environments) than the use of 0 and some nonzero value like 1 or -1.
>
> And in fact, it was so before my patch.
As your own earlier comment says, do_cmd() negates the return value.
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists