Skip to content
Snippets Groups Projects
Commit 4cf38c1c authored by Herbert Xu's avatar Herbert Xu
Browse files

builtin: Fix echo -n early termination


The commit 7a784244 ("[BUILTIN]
Simplify echo command") broke echo -n by making it always terminate
after printing the first argument.

This patch fixes this by only terminating when we have reached
the end of the arguments.

Fixes: 7a784244 ("[BUILTIN] Simplify echo command")
Reported-by: default avatarLuigi Tarenga <luigi.tarenga@gmail.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 0e4c9599
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -459,7 +459,7 @@ echocmd(int argc, char **argv)
 
if (likely(*argv))
nonl += print_escape_str("%s", NULL, NULL, *argv++);
if (nonl > 0)
if (likely((nonl + !*argv) > 1))
break;
 
c = *argv ? ' ' : '\n';
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment