Thread (10 messages) 10 messages, 2 authors, 2016-03-17

Re: [PATCH 2/4] rt-migrate-test: fix return code

From: John Kacur <jkacur@redhat.com>
Date: 2016-03-16 22:14:13


On Wed, 24 Feb 2016, Luiz Capitulino wrote:
quoted hunk ↗ jump to hunk
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 <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help