From 50cba081dcfa586aad8a5c600c751f44fea107e2 Mon Sep 17 00:00:00 2001 From: Erik Auerswald Date: Sat, 8 Mar 2025 20:02:53 +0100 Subject: [PATCH] fix debug build use of dbg_printf in fping.c config.h must be include before fping.h, because configure --enable-debug writes the DEBUG #define to config.h, and the dbg_printf macro definition requires a defined DEBUG to actually produce any output. Unbreaking dbg_printf() exposed an instance of wrong use, so fix that. Also, add a newline to the debug output reporting used CPU time. --- src/fping.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/fping.c b/src/fping.c index a7acb2f..9aa527a 100644 --- a/src/fping.c +++ b/src/fping.c @@ -34,8 +34,8 @@ extern "C" { #endif /* __cplusplus */ -#include "fping.h" #include "config.h" +#include "fping.h" #include "options.h" #include "optparse.h" @@ -1339,7 +1339,7 @@ int main(int argc, char **argv) #if defined(DEBUG) || defined(_DEBUG) perf_cpu_end = clock(); perf_cpu_time_used = ((double) (perf_cpu_end - perf_cpu_start)) / CLOCKS_PER_SEC; - printf("[DEBUG] CPU time used: %f sec", perf_cpu_time_used); + printf("[DEBUG] CPU time used: %f sec\n", perf_cpu_time_used); #endif /* DEBUG || _DEBUG */ finish(); @@ -2757,7 +2757,7 @@ int wait_for_reply(int64_t wait_time) /* optionally require reply source equal to target address */ if (check_source_flag && addr_cmp((struct sockaddr *)&response_addr, (struct sockaddr *)&h->saddr)) { - dbg_printf("discarding reply from wrong source address\n"); + dbg_printf("%s\n", "discarding reply from wrong source address"); return 1; } -- 2.43.0