From: Petri Lehtinen Date: Wed, 10 Sep 2008 06:43:49 +0000 (+0300) Subject: autoscr: Fix one-character lines and non-newline terminated scripts X-Git-Tag: v2008.10-rc2~13 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=3591293509e0c0bcf244b0f974775bff2e25697e;p=u-boot autoscr: Fix one-character lines and non-newline terminated scripts When not using hush, the autoscr command now executes lines that are only one character long. It also runs the last line of scripts even if it does not end in a newline. Signed-off-by: Petri Lehtinen --- diff --git a/common/cmd_autoscript.c b/common/cmd_autoscript.c index c2e7e665aa..0439da2cd3 100644 --- a/common/cmd_autoscript.c +++ b/common/cmd_autoscript.c @@ -180,7 +180,7 @@ autoscript (ulong addr, const char *fit_uname) if (*next == '\n') { *next = '\0'; /* run only non-empty commands */ - if ((next - line) > 1) { + if (*line) { debug ("** exec: \"%s\"\n", line); if (run_command (line, 0) < 0) { @@ -192,6 +192,8 @@ autoscript (ulong addr, const char *fit_uname) } ++next; } + if (rcode == 0 && *line) + rcode = (run_command(line, 0) >= 0); } #endif free (cmd);