From 0660aeed69f81601f31b29c36d300a9e6e6276f6 Mon Sep 17 00:00:00 2001 From: "Michael E. Johnson" Date: Thu, 16 Mar 2023 16:18:12 -0500 Subject: [PATCH] process the scanf() output so Ubuntu 22 compiler doesn't error due to default warn_unused_result instead of Makefile -Wunused-result --- chat.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chat.cpp b/chat.cpp index f72ad14f3..885d1f69a 100644 --- a/chat.cpp +++ b/chat.cpp @@ -1035,7 +1035,7 @@ int main(int argc, char ** argv) { if(params.use_color) printf(ANSI_BOLD ANSI_COLOR_GREEN); if (scanf("%255[^\n]%n%*c", buf, &n_read) <= 0) { // presumable empty line, consume the newline - scanf("%*c"); + if (scanf("%*c") <= 0) { /*ignore*/ } n_read=0; } if(params.use_color) printf(ANSI_COLOR_RESET);