linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Kacur <jkacur@redhat.com>
To: Luiz Capitulino <lcapitulino@redhat.com>
Cc: linux-rt-users@vger.kernel.org, williams@redhat.com
Subject: Re: [PATCH 2/4] rt-migrate-test: fix return code
Date: Wed, 16 Mar 2016 23:14:10 +0100 (CET)	[thread overview]
Message-ID: <alpine.LFD.2.20.1603162312320.16977@riemann> (raw)
In-Reply-To: <1456346981-24032-3-git-send-email-lcapitulino@redhat.com>



On Wed, 24 Feb 2016, Luiz Capitulino wrote:

> Change both return codes for the stop == true case:
> 
>  * For failures, use exit(1) as exit(-1) is wrong
>    (it actually becomes 255 in the shell)
> 
>  * For success, use exit(2) instead of exit(1) as
>    exit(1) is usually used for errors
> 
> This should preserve the requirement of allowing
> shell script while loops to break when Ctrl-C is hit.
> 
> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
> ---
>  src/rt-migrate-test/rt-migrate-test.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/rt-migrate-test/rt-migrate-test.c b/src/rt-migrate-test/rt-migrate-test.c
> index fc6fd81..6e8acc2 100644
> --- a/src/rt-migrate-test/rt-migrate-test.c
> +++ b/src/rt-migrate-test/rt-migrate-test.c
> @@ -594,9 +594,9 @@ int main (int argc, char **argv)
>  		 * loop know to break.
>  		 */
>  		if (check < 0)
> -			exit(-1);
> -		else
>  			exit(1);
> +		else
> +			exit(2);
>  	}
>  	if (check < 0)
>  		exit(-1);
> -- 
> 2.1.0
> 
> --

You can change the failure status from -1 to 1 if you wish, this is the 
normal value for EXIT_FAILURE

However the normal value for EXIT_SUCCESS is 0, so please do not change 
that.

Thanks

John

  reply	other threads:[~2016-03-16 22:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-24 20:49 [PATCH 0/4] rt-tests: minor fixes Luiz Capitulino
2016-02-24 20:49 ` [PATCH 1/4] pip_stress: drop unused variable Luiz Capitulino
2016-03-16 22:00   ` John Kacur
2016-03-17 13:22     ` Luiz Capitulino
2016-02-24 20:49 ` [PATCH 2/4] rt-migrate-test: fix return code Luiz Capitulino
2016-03-16 22:14   ` John Kacur [this message]
2016-03-17 13:25     ` Luiz Capitulino
2016-02-24 20:49 ` [PATCH 3/4] don't use exit(-1) for failures Luiz Capitulino
2016-03-16 22:19   ` John Kacur
2016-02-24 20:49 ` [PATCH 4/4] cyclictest: initialize 'stop' early Luiz Capitulino

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=alpine.LFD.2.20.1603162312320.16977@riemann \
    --to=jkacur@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=williams@redhat.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).