[PATCH] run-command: simplify wait_or_whine

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

 



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

Signed-off-by: Felipe Contreras <felipe.contreras@xxxxxxxxx>
---
 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

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