diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2021-02-22 10:39:39 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2021-02-22 10:39:39 +0100 |
commit | e59a93e1d5689ae174051f4179f3a8a283492f46 (patch) | |
tree | d9938ce3c87eab8b88e27e1c72f3b790bc18eb97 /commands | |
parent | 9eff9ce48c2e2398a52f0d9d572c0a15f1a50de9 (diff) | |
parent | 87d6abb654b993948a9eea2169ffe7d5fc631154 (diff) | |
download | barebox-e59a93e1d5689ae174051f4179f3a8a283492f46.tar.gz barebox-e59a93e1d5689ae174051f4179f3a8a283492f46.tar.xz |
Merge branch 'for-next/misc'
Diffstat (limited to 'commands')
-rw-r--r-- | commands/readline.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/commands/readline.c b/commands/readline.c index ef54b5e92f..403ac8563a 100644 --- a/commands/readline.c +++ b/commands/readline.c @@ -4,6 +4,7 @@ #include <common.h> #include <command.h> #include <malloc.h> +#include <slice.h> #include <xfuncs.h> #include <environment.h> @@ -14,15 +15,20 @@ static int do_readline(int argc, char *argv[]) if (argc < 3) return COMMAND_ERROR_USAGE; + command_slice_release(); + if (readline(argv[1], buf, CONFIG_CBSIZE) < 0) { + command_slice_acquire(); free(buf); - return 1; + return COMMAND_ERROR; } + command_slice_acquire(); + setenv(argv[2], buf); free(buf); - return 0; + return COMMAND_SUCCESS; } BAREBOX_CMD_HELP_START(readline) |