From 1e5f903205905fe7ebce897d1b7e6f5e8ab591f6 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Wed, 9 Jan 2019 12:42:47 -0300 Subject: [PATCH] shared/shell: Fix compilation error asprintf return is not check which is catch by -Werror=unused-result so in case asprintf fails don't set any prompt. --- src/shared/shell.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/shared/shell.c b/src/shared/shell.c index 6e6648cfa..709d20556 100644 --- a/src/shared/shell.c +++ b/src/shared/shell.c @@ -573,10 +573,12 @@ void bt_shell_prompt_input(const char *label, const char *msg, if (data.saved_prompt) return; + if (asprintf(&str, "[%s] %s ", label, msg) < 0) + return; + data.saved_prompt = true; data.saved_func = func; data.saved_user_data = user_data; - asprintf(&str, "[%s] %s ", label, msg); rl_save_prompt(); bt_shell_set_prompt(str); -- 2.47.3