Re: [PATCH] run-command: simplify wait_or_whine
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- Jun 1, 2013, 14:03 UTC
- Message-ID
- <CACsJy8BRYHkSj1YR9mW=_tdKX_+xKNxpVx+RNYEdoW3S36w=8Q@mail.gmail.com>
- In-Reply-To
- <1370094715-2684-1-git-send-email-felipe.contreras@gmail.com>
On Sat, Jun 1, 2013 at 8:51 PM, Felipe Contreras <felipe.contreras@gmail.com> wrote:
> Nobody is checking for specific error codes; it's the errno that's > important.
Have you just disregarded the in-code comment you just removed with one statement? Did you check all its callers?
Show 41 quoted lines
>
> 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
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html-- Duy