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>
This commit is contained in:
Joe Hershberger 2013-02-08 10:12:34 +00:00 committed by Tom Rini
parent 949a771097
commit 18a3cce9fa

View 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);
}