From 9eb0055d0ae9b08b0c03be72bc761657402483c3 Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Wed, 6 Mar 2024 19:45:19 +0100 Subject: commands: dmesg: support aborting dmesg output with ctrl-c dmesg output can get very long, especially if debug messages are compiled in and the maximum number of retained log messages is increased. Therefore, follow what we do for other potentially long-running commands and allow the user to abort it with ctrl+c. Signed-off-by: Ahmad Fatoum Link: https://lore.barebox.org/20240306184519.626594-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer --- commands/dmesg.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'commands') diff --git a/commands/dmesg.c b/commands/dmesg.c index 83410234e1..8a60f07507 100644 --- a/commands/dmesg.c +++ b/commands/dmesg.c @@ -76,7 +76,7 @@ static unsigned dmesg_get_levels(const char *__args) static int do_dmesg(int argc, char *argv[]) { - int opt, i; + int opt, ret, i; int delete_buf = 0, emit = 0; unsigned flags = 0, levels = 0; char *set = NULL; @@ -148,7 +148,9 @@ static int do_dmesg(int argc, char *argv[]) return 0; } - log_print(flags, levels); + ret = log_print(flags, levels); + if (ret) + return 1; if (delete_buf) log_clean(10); -- cgit v1.2.3