From f87ebc19da380403f85106efbd6d72cf49478b50 Mon Sep 17 00:00:00 2001 From: Rouven Czerwinski Date: Wed, 10 Feb 2021 12:58:08 +0100 Subject: commands: readline: use exit code macros Signed-off-by: Rouven Czerwinski Signed-off-by: Sascha Hauer --- commands/readline.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'commands') diff --git a/commands/readline.c b/commands/readline.c index ef54b5e92f..85b04a3903 100644 --- a/commands/readline.c +++ b/commands/readline.c @@ -16,13 +16,13 @@ static int do_readline(int argc, char *argv[]) if (readline(argv[1], buf, CONFIG_CBSIZE) < 0) { free(buf); - return 1; + return COMMAND_ERROR; } setenv(argv[2], buf); free(buf); - return 0; + return COMMAND_SUCCESS; } BAREBOX_CMD_HELP_START(readline) -- cgit v1.2.3 From ecd1539d9333c0d4a743555dc874ea7a83ee9ea7 Mon Sep 17 00:00:00 2001 From: Rouven Czerwinski Date: Wed, 10 Feb 2021 12:58:10 +0100 Subject: 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 Signed-off-by: Sascha Hauer --- commands/readline.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'commands') 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 #include #include +#include #include #include @@ -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); -- cgit v1.2.3