[U-Boot] [PATCH 1/5] Check for NULL prompt in readline_into_buffer()

Peter Tyser ptyser at xes-inc.com
Fri Oct 23 02:59:19 CEST 2009


Previously, passing readline() or readline_into_buffer() a NULL 'prompt'
parameter would result in puts() printing garbage when
CONFIG_CMDLINE_EDITING was enabled.

Signed-off-by: Peter Tyser <ptyser at xes-inc.com>
---
 common/main.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/common/main.c b/common/main.c
index 026edd1..298982a 100644
--- a/common/main.c
+++ b/common/main.c
@@ -964,7 +964,8 @@ int readline_into_buffer (const char *const prompt, char * buffer)
 			initted = 1;
 		}
 
-		puts (prompt);
+		if (prompt)
+			puts (prompt);
 
 		rc = cread_line(prompt, p, &len);
 		return rc < 0 ? rc : len;
-- 
1.6.2.1



More information about the U-Boot mailing list