From 11f0a9ed46af7823dd9162379b5ace8c61237897 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Mon, 13 Jun 2022 20:31:23 +0200 Subject: [PATCH] audiod: Fix time diff warning log message. The format string contains %lu to print a long unsigned, but we possibly multiply the value with -1, which can lead to output like Jun 13 13:36:37 baader (3) compute_time_diff: time diff jump: 4294808018ms Fix this by replacing the multiplication with an additional format string directive to print the leading +/- explicitly. This is easy since we already have the sign in a variable, and it avoids any integer conversion/overflow issues. --- audiod.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/audiod.c b/audiod.c index 113f1132..c565d441 100644 --- a/audiod.c +++ b/audiod.c @@ -749,8 +749,8 @@ static void compute_time_diff(const struct timeval *status_time) if (count > 5) { int s = tv_diff(&diff, &stat_task->sa_time_diff, &tmp); if (tv_diff(&max_deviation, &tmp, NULL) < 0) - PARA_WARNING_LOG("time diff jump: %lums\n", - s * tv2ms(&tmp)); + PARA_WARNING_LOG("time diff jump: %c%lums\n", + s < 0? '-' : '+', tv2ms(&tmp)); } count++; sa_time_diff_sign = tv_convex_combination( -- 2.39.2