From: Andre Noll Date: Mon, 13 Jun 2022 18:31:23 +0000 (+0200) Subject: audiod: Fix time diff warning log message. X-Git-Tag: v0.7.1~12 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=11f0a9ed46af7823dd9162379b5ace8c61237897;p=paraslash.git 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. --- 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(