[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