summaryrefslogtreecommitdiff
path: root/common/cmd_nvedit.c
diff options
context:
space:
mode:
authorJoe Hershberger <joe.hershberger@ni.com>2013-02-08 10:12:34 +0000
committerTom Rini <trini@ti.com>2013-03-04 14:19:56 -0500
commit18a3cce9fa9030e0e1fe0678ddcd0ae84d9423ca (patch)
tree653ffc1e57065f55a7fffd46693f29182190ca3b /common/cmd_nvedit.c
parent949a77109747d5db7d559359d3ec24bade653be8 (diff)
downloadu-boot-imx-18a3cce9fa9030e0e1fe0678ddcd0ae84d9423ca.zip
u-boot-imx-18a3cce9fa9030e0e1fe0678ddcd0ae84d9423ca.tar.gz
u-boot-imx-18a3cce9fa9030e0e1fe0678ddcd0ae84d9423ca.tar.bz2
env: Avoid clobbering an edited variable on ctrl-c
If readline says there was an error, don't write to the variable! Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Diffstat (limited to 'common/cmd_nvedit.c')
-rw-r--r--common/cmd_nvedit.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index d646d90..3a05e60 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);
}