summaryrefslogtreecommitdiffstats
path: root/commands/readline.c
diff options
context:
space:
mode:
authorRouven Czerwinski <r.czerwinski@pengutronix.de>2021-02-10 12:58:10 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2021-02-16 10:33:04 +0100
commitecd1539d9333c0d4a743555dc874ea7a83ee9ea7 (patch)
tree5627d25bb210f60d51d03465ea0ca8cd31ae89f2 /commands/readline.c
parentf87ebc19da380403f85106efbd6d72cf49478b50 (diff)
downloadbarebox-ecd1539d9333c0d4a743555dc874ea7a83ee9ea7.tar.gz
barebox-ecd1539d9333c0d4a743555dc874ea7a83ee9ea7.tar.xz
commands: readline: release command slice
Release the command slice around readline to let the workqueues run while waiting for input. Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands/readline.c')
-rw-r--r--commands/readline.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/commands/readline.c b/commands/readline.c
index 85b04a3903..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,11 +15,16 @@ 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 COMMAND_ERROR;
}
+ command_slice_acquire();
+
setenv(argv[2], buf);
free(buf);