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/commit.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/builtin/commit.c b/builtin/commit.c index 009a1de0a3..13af49fdd2 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -496,7 +496,7 @@ static const char *prepare_index(const char **argv, const char *prefix, } if (list_paths(&partial, !current_head ? NULL : "HEAD", &pathspec)) - exit(1); + exit(EXIT_FAILURE); discard_cache(); if (read_cache() < 0) @@ -1081,7 +1081,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix, if (launch_editor(git_path_commit_editmsg(), NULL, env.v)) { fprintf(stderr, _("Please supply the message using either -m or -F option.\n")); - exit(1); + exit(EXIT_FAILURE); } strvec_clear(&env); } @@ -1785,12 +1785,12 @@ int cmd_commit(int argc, const char **argv, const char *prefix) if (message_is_empty(&sb, cleanup_mode) && !allow_empty_message) { rollback_index_files(); fprintf(stderr, _("Aborting commit due to empty commit message.\n")); - exit(1); + exit(EXIT_FAILURE); } if (template_untouched(&sb, template_file, cleanup_mode) && !allow_empty_message) { rollback_index_files(); fprintf(stderr, _("Aborting commit; you did not edit the message.\n")); - exit(1); + exit(EXIT_FAILURE); } if (fixup_message && starts_with(sb.buf, "amend! ") && @@ -1801,7 +1801,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix) if (message_is_empty(&body, cleanup_mode)) { rollback_index_files(); fprintf(stderr, _("Aborting commit due to empty commit message body.\n")); - exit(1); + exit(EXIT_FAILURE); } strbuf_release(&body); } -- 2.35.1