Re: [PATCH] run-command: simplify wait_or_whine

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

 



On Sat, Jun 1, 2013 at 8:51 PM, Felipe Contreras
<felipe.contreras@xxxxxxxxx> wrote:
> 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)) {

The original commit that introduces this says

    run_command: encode deadly signal number in the return value

    We now write the signal number in the error message if the program
    terminated by a signal. The negative return value is constructed such that
    after truncation to 8 bits it looks like a POSIX shell's $?:

       $ echo 0000 | { git upload-pack .; echo $? >&2; } | :
       error: git-upload-pack died of signal 13
       141

    Previously, the exit code was 255 instead of 141.

So this is part of the interface to the user. With your changes, the
exit code is now different. I tested by force segfaulting upload-pack.
$? returned 11. So NAK.
--
Duy
--
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]