mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [Patch] hush exit code fix
@ 2010-03-05 10:51 Jan Weitzel
  2010-03-12  9:01 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Weitzel @ 2010-03-05 10:51 UTC (permalink / raw)
  To: barebox

hush: pass return code from exit command within if statement

Signed-off-by: Jan Weitzel <j.weitzel@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) {



_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Patch] hush exit code fix
  2010-03-05 10:51 [Patch] hush exit code fix Jan Weitzel
@ 2010-03-12  9:01 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2010-03-12  9:01 UTC (permalink / raw)
  To: Jan Weitzel; +Cc: barebox

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

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-03-12  9:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-05 10:51 [Patch] hush exit code fix Jan Weitzel
2010-03-12  9:01 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox