[PATCH 1/7] Truncate result of run_command that is used in exit() to lowest 8 bits

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

 



On Windows, negative return values are not detected reliably by the parent
process as failure. This fixes it.

Signed-off-by: Johannes Sixt <j6t@xxxxxxxx>
---
 bisect.c      |    4 ++--
 builtin-add.c |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/bisect.c b/bisect.c
index 52220df..b395c47 100644
--- a/bisect.c
+++ b/bisect.c
@@ -760,7 +760,7 @@ static int bisect_checkout(char *bisect_rev_hex)
 	argv_checkout[2] = bisect_rev_hex;
 	res = run_command_v_opt(argv_checkout, RUN_GIT_CMD);
 	if (res)
-		exit(res);
+		exit(res & 0xff);
 
 	argv_show_branch[1] = bisect_rev_hex;
 	return run_command_v_opt(argv_show_branch, RUN_GIT_CMD);
@@ -850,7 +850,7 @@ static void check_merge_bases(void)
 			handle_skipped_merge_base(mb);
 		} else {
 			printf("Bisecting: a merge base must be tested\n");
-			exit(bisect_checkout(sha1_to_hex(mb)));
+			exit(bisect_checkout(sha1_to_hex(mb)) & 0xff);
 		}
 	}
 
diff --git a/builtin-add.c b/builtin-add.c
index 4e44148..d83e67e 100644
--- a/builtin-add.c
+++ b/builtin-add.c
@@ -305,7 +305,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
 	if (patch_interactive)
 		add_interactive = 1;
 	if (add_interactive)
-		exit(interactive_add(argc - 1, argv + 1, prefix));
+		exit(interactive_add(argc - 1, argv + 1, prefix) & 0xff);
 
 	if (edit_interactive)
 		return(edit_patch(argc, argv, prefix));
-- 
1.6.3.17.g1665f

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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]