]> git.sur5r.net Git - u-boot/commitdiff
env: Avoid clobbering an edited variable on ctrl-c
authorJoe Hershberger <joe.hershberger@ni.com>
Fri, 8 Feb 2013 10:12:34 +0000 (10:12 +0000)
committerTom Rini <trini@ti.com>
Mon, 4 Mar 2013 19:19:56 +0000 (14:19 -0500)
If readline says there was an error, don't write to the variable!

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
common/cmd_nvedit.c

index d646d90880edc3e258e0b375c2d601d465a2a895..3a05e6010306f6053624514c48843c375e43b9f6 100644 (file)
@@ -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);
 }