From 49015a60cb334ecd0b069f27833a3d50853509fa Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Tue, 3 Apr 2018 13:02:43 +0200 Subject: hush: fix mishandling of "true | f() { echo QWE; }" function old new delta run_pipe 1820 1826 +6 Signed-off-by: Denys Vlasenko --- shell/hush.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'shell/hush.c') diff --git a/shell/hush.c b/shell/hush.c index b64993f..94e429c 100644 --- a/shell/hush.c +++ b/shell/hush.c @@ -7705,6 +7705,15 @@ static void pseudo_exec(nommu_save_t *nommu_save, struct command *command, char **argv_expanded) { +#if ENABLE_HUSH_FUNCTIONS + if (command->cmd_type == CMD_FUNCDEF) { + /* Ignore funcdefs in pipes: + * true | f() { cmd } + */ + _exit(0); + } +#endif + if (command->argv) { pseudo_exec_argv(nommu_save, command->argv, command->assignment_cnt, argv_expanded); -- cgit v1.1