git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] run-command: simplify wait_or_whine

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Jun 1, 2013, 13:51 UTC
Message-ID
<1370094715-2684-1-git-send-email-felipe.contreras@gmail.com>

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
Next: Duy Nguyen
Message 1 of 15 in “run-command: simplify wait_or_whine”
  1. run-command: simplify wait_or_whineFelipe Contreras, Jun 1, 2013
  2. Duy NguyenJun 1, 2013
  3. Felipe ContrerasJun 1, 2013
  4. Duy NguyenJun 1, 2013
  5. Felipe ContrerasJun 1, 2013
  6. Thomas RastJun 1, 2013
  7. Felipe ContrerasJun 1, 2013
  8. Duy NguyenJun 1, 2013
  9. Felipe ContrerasJun 1, 2013
  10. Duy NguyenJun 1, 2013
  11. Felipe ContrerasJun 1, 2013
  12. t0005: test git exit code from signal deathJeff King, Jun 1, 2013
  13. Felipe ContrerasJun 1, 2013
  14. Jeff KingJun 1, 2013
  15. Felipe ContrerasJun 1, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.