[Patch] hush exit code fix

Sascha Hauer s.hauer at pengutronix.de
Fri Mar 12 04:01:33 EST 2010


Hi Jan,

On Fri, Mar 05, 2010 at 11:51:50AM +0100, Jan Weitzel wrote:
> hush: pass return code from exit command within if statement
> 
> Signed-off-by: Jan Weitzel <j.weitzel at phytec.de>
> ---
> diff --git a/common/hush.c b/common/hush.c
> index cf6704b..ae09374 100644
> --- a/common/hush.c
> +++ b/common/hush.c
> @@ -535,10 +535,9 @@ static int run_pipe_real(struct pipe *pi)
>         if (pi->num_progs == 1)
>                 child = & (pi->progs[0]);
>         if (pi->num_progs == 1 && child->group) {
> -               int rcode;
>                 debug("non-subshell grouping\n");
> -               rcode = run_list_real(child->group);
> -               return rcode;
> +               run_list_real(child->group);
> +               return last_return_code;
>         } else if (pi->num_progs == 1 && pi->progs[0].argv != NULL) {
>                 for (i=0; is_assignment(child->argv[i]); i++) { /* nothing */ }
>                 if (i!=0 && child->argv[i]==NULL) {
> 
> 
> 

This does not solve the problem and introduces a new one:

barebox:/ cat /env/bin/bar
false
if [ $? != 0 ]; then
        echo tschuess
        exit
fi

echo hallo

barebox:/ bar
tschuess
hallo
barebox:/


Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list