From bdf058a9cfaba6df0fe9123820ed7b06f438c368 Mon Sep 17 00:00:00 2001 From: Robert Burger Date: Tue, 24 Sep 2024 06:41:03 +0200 Subject: [PATCH] fix: printing foe read/write counter --- tools/foe_tool/foe_tool.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/foe_tool/foe_tool.c b/tools/foe_tool/foe_tool.c index 4839cd9..9209484 100644 --- a/tools/foe_tool/foe_tool.c +++ b/tools/foe_tool/foe_tool.c @@ -72,10 +72,11 @@ void no_verbose_log(int lvl, void *user, const char *format, ...) { va_list ap; va_start(ap, format); - if ( (strstr(format, "sending file offset") != NULL) || - (strstr(format, "retrieving file offset") != NULL) ) + vsnprintf(&message[1], 511, format, ap); + + if ( (strstr(&message[1], "sending file offset") != NULL) || + (strstr(&message[1], "retrieving file offset") != NULL) ) { - vsnprintf(&message[1], 511, format, ap); message[0] = '\r'; message[strlen(message)-1] = '\0'; fprintf(stderr, "%s", message); @@ -86,6 +87,7 @@ void no_verbose_log(int lvl, void *user, const char *format, ...) { fprintf(stderr, "\n"); } + va_start(ap, format); vfprintf(stderr, format, ap); } va_end(ap);