hush exit code fix
PATCH 1/1 hush exit code fix
hush: pass return code from exit command within if statement
Signed-off-by Jan Weitzel <[email protected]>
---
common/hush.c +2 -3
@@ -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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Hi Jan,
Quoted 14 lines · Jan Weitzel
hush: pass return code from exit command within if statement
Signed-off-by Jan Weitzel <[email protected]>---
common/hush.c +0
-0@@ -535,10 +535,9 @@ static int run_pipe_real(struct pipe *pi)if (pi->num_progs ==1 ) child = & (pi->progs[0 ]);
common/hush.c static int run_pipe_real(struct pipe *pi) · line 543
Quoted 10 lines
common/hush.c +2
-3if (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
Signature · 9 lines
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 [email protected] http://lists.infradead.org/mailman/listinfo/barebox