[PATCH 13/41] rebase.c: use the stdlib EXIT_SUCCESS or EXIT_FAILURE exit status

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The C standard specifies two constants, EXIT_SUCCESS and  EXIT_FAILURE, that may
be  passed  to exit() to indicate successful or unsuccessful termination,
respectively. The value of status in exit(status) may be EXIT_SUCCESS,
EXIT_FAILURE, or any other value, though only the least significant 8 bits (that
is, status & 0377) shall be available to a waiting parent proces. So exit(-1)
return 255.

Use the C standard EXIT_SUCCESS and EXIT_FAILURE to indicate the program exit
status instead of "0" or "1", respectively. In <stdlib.h> EXIT_FAILURE has the
value "1": use EXIT_FAILURE even if the program uses exit(-1), ie 255, for
consistency.

Signed-off-by: Elia Pinto <gitter.spiros@xxxxxxxxx>
---
 builtin/rebase.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/builtin/rebase.c b/builtin/rebase.c
index b29ad2b65e..cafacc87f8 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -988,7 +988,7 @@ static void NORETURN error_on_missing_default_upstream(void)
 			 "\n"),
 		       remote, current_branch->name);
 	}
-	exit(1);
+	exit(EXIT_FAILURE);
 }
 
 static void set_reflog_action(struct rebase_options *options)
@@ -1266,10 +1266,10 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 		if (has_unstaged_changes(the_repository, 1)) {
 			puts(_("You must edit all merge conflicts and then\n"
 			       "mark them as resolved using git add"));
-			exit(1);
+			exit(EXIT_FAILURE);
 		}
 		if (read_basic_state(&options))
-			exit(1);
+			exit(EXIT_FAILURE);
 		goto run_rebase;
 	}
 	case ACTION_SKIP: {
@@ -1285,7 +1285,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 			die(_("could not discard worktree changes"));
 		remove_branch_state(the_repository, 0);
 		if (read_basic_state(&options))
-			exit(1);
+			exit(EXIT_FAILURE);
 		goto run_rebase;
 	}
 	case ACTION_ABORT: {
@@ -1297,7 +1297,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 		string_list_clear(&merge_rr, 1);
 
 		if (read_basic_state(&options))
-			exit(1);
+			exit(EXIT_FAILURE);
 		ropts.oid = &options.orig_head;
 		ropts.branch = options.head_name;
 		ropts.flags = RESET_HEAD_HARD;
@@ -1388,7 +1388,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 
 	for (i = 0; i < exec.nr; i++)
 		if (check_exec_cmd(exec.items[i].string))
-			exit(1);
+			exit(EXIT_FAILURE);
 
 	if (!(options.flags & REBASE_NO_QUIET))
 		strvec_push(&options.git_am_opts, "-q");
-- 
2.35.1




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux