netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
To: Ben Hutchings <bhutchings@solarflare.com>
Cc: eric.dumazet@gmail.com, shemminger@vyatta.com,
	netdev@vger.kernel.org, junwei.zhang@6wind.com
Subject: Re: [PATCH iproute2 v4] ipbatch: fix use of 'ip netns exec'
Date: Wed, 10 Jul 2013 11:52:12 +0200	[thread overview]
Message-ID: <51DD2ECC.7010501@6wind.com> (raw)
In-Reply-To: <1373393602.2523.4.camel@bwh-desktop.uk.level5networks.com>

Le 09/07/2013 20:13, Ben Hutchings a écrit :
> 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.
Yes, but EXIT_FAILURE is used everywhere in ip/ipnetns.c.

Stephen, should I send a patch to replace use of EXIT_FAILURE by -1 in ipnetns.c?

      reply	other threads:[~2013-07-10  9:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20130705141639.56b47e7e@samsung-9>
2013-07-08  9:44 ` [PATCH iproute2 v2] ipbatch: fix use of 'ip netns exec' Nicolas Dichtel
2013-07-08 23:36   ` Ben Hutchings
2013-07-09 10:26     ` [PATCH iproute2 v3] " Nicolas Dichtel
2013-07-09 13:20       ` Eric Dumazet
2013-07-09 15:55         ` [PATCH iproute2 v4] " Nicolas Dichtel
2013-07-09 16:19           ` Ben Hutchings
2013-07-09 16:59             ` Nicolas Dichtel
2013-07-09 18:13               ` Ben Hutchings
2013-07-10  9:52                 ` Nicolas Dichtel [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51DD2ECC.7010501@6wind.com \
    --to=nicolas.dichtel@6wind.com \
    --cc=bhutchings@solarflare.com \
    --cc=eric.dumazet@gmail.com \
    --cc=junwei.zhang@6wind.com \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@vyatta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).