git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] run-command: simplify wait_or_whine
@ 2013-06-01 13:51 Felipe Contreras
  2013-06-01 14:03 ` Duy Nguyen
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Felipe Contreras @ 2013-06-01 13:51 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Jeff King, Johannes Sixt, Jonathan Nieder,
	John J. Franey, Felipe Contreras

Nobody is checking for specific error codes; it's the errno that's
important.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 run-command.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/run-command.c b/run-command.c
index 1b32a12..e54e943 100644
--- a/run-command.c
+++ b/run-command.c
@@ -244,21 +244,11 @@ static int wait_or_whine(pid_t pid, const char *argv0)
 		code = WTERMSIG(status);
 		if (code != SIGINT && code != SIGQUIT)
 			error("%s died of signal %d", argv0, code);
-		/*
-		 * This return value is chosen so that code & 0xff
-		 * mimics the exit code that a POSIX shell would report for
-		 * a program that died from this signal.
-		 */
-		code += 128;
 	} else if (WIFEXITED(status)) {
 		code = WEXITSTATUS(status);
-		/*
-		 * Convert special exit code when execvp failed.
-		 */
-		if (code == 127) {
-			code = -1;
+		/* convert special exit code when execvp failed. */
+		if (code == 127)
 			failed_errno = ENOENT;
-		}
 	} else {
 		error("waitpid is confused (%s)", argv0);
 	}
-- 
1.8.3.358.g5a91d05

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2013-06-01 21:41 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-01 13:51 [PATCH] run-command: simplify wait_or_whine Felipe Contreras
2013-06-01 14:03 ` Duy Nguyen
2013-06-01 14:06   ` Felipe Contreras
2013-06-01 14:08     ` Duy Nguyen
2013-06-01 14:20       ` Felipe Contreras
2013-06-01 14:19 ` Thomas Rast
2013-06-01 14:23   ` Felipe Contreras
2013-06-01 14:21 ` Duy Nguyen
2013-06-01 14:30   ` Felipe Contreras
2013-06-01 14:36     ` Duy Nguyen
2013-06-01 15:01       ` Felipe Contreras
2013-06-01 17:24         ` [PATCH] t0005: test git exit code from signal death Jeff King
2013-06-01 21:41           ` Felipe Contreras
2013-06-01 17:01     ` [PATCH] run-command: simplify wait_or_whine Jeff King
2013-06-01 21:35       ` Felipe Contreras

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).