summaryrefslogtreecommitdiffstats
path: root/common/hush.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-04-29 12:07:09 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2012-04-30 13:08:54 +0200
commit162e2a820d25f03f9fce0bf84ddca168b8020027 (patch)
treef86c0a640c5bb747d696a1c1e96860b4e1668f34 /common/hush.c
parent86c031783ffa54513785b4b69fd506645035332e (diff)
downloadbarebox-162e2a820d25f03f9fce0bf84ddca168b8020027.tar.gz
hush: run_pipe_real must have num_progs == 1
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/hush.c')
-rw-r--r--common/hush.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/common/hush.c b/common/hush.c
index 4e78577..362f544 100644
--- a/common/hush.c
+++ b/common/hush.c
@@ -596,14 +596,16 @@ static int run_pipe_real(struct p_context *ctx, struct pipe *pi)
nextin = 0;
- /* Check if this is a simple builtin (not part of a pipe).
- * Builtins within pipes have to fork anyway, and are handled in
- * pseudo_exec. "echo foo | read bar" doesn't work on bash, either.
+ /*
+ * We do not support pipes in barebox, so pi->num_progs can't
+ * be bigger than 1. pi->num_progs == 0 is already catched in
+ * the caller, so everything else than 1 is a bug.
*/
- if (pi->num_progs == 1)
- child = &pi->progs[0];
+ BUG_ON(pi->num_progs != 1);
+
+ child = &pi->progs[0];
- if (pi->num_progs == 1 && child->group) {
+ if (child->group) {
int rcode;
debug("non-subshell grouping\n");
@@ -612,7 +614,7 @@ static int run_pipe_real(struct p_context *ctx, struct pipe *pi)
return rcode;
}
- if (pi->num_progs == 1 && pi->progs[0].argv != NULL) {
+ if (pi->progs[0].argv != NULL) {
for (i = 0; is_assignment(child->argv[i]); i++)
{ /* nothing */ }