[U-Boot] [PATCH] env: Avoid clobbering an edited variable on ctrl-c

Joe Hershberger joe.hershberger at ni.com
Fri Feb 8 21:12:34 CET 2013


If readline says there was an error, don't write to the variable!

Signed-off-by: Joe Hershberger <joe.hershberger at ni.com>
---
 common/cmd_nvedit.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index 7633f0c..063536b 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -552,7 +552,8 @@ static int do_env_edit(cmd_tbl_t *cmdtp, int flag, int argc,
 	else
 		buffer[0] = '\0';
 
-	readline_into_buffer("edit: ", buffer, 0);
+	if (readline_into_buffer("edit: ", buffer, 0) < 0)
+		return 1;
 
 	return setenv(argv[1], buffer);
 }
-- 
1.7.11.5



More information about the U-Boot mailing list