teknoraver / rpms / systemd

Forked from rpms/systemd 3 months ago
Clone
Blob Blame History Raw
From 416ca19f3149e44fee7fee2df9b8e63042076fda Mon Sep 17 00:00:00 2001
From: Matija Skala <mskala@gmx.com>
Date: Fri, 19 May 2017 14:36:40 +0200
Subject: [PATCH] timesync/timesyncd-manager: fix format-specifier issue

timex::time::tv_sec can have different sizes depending on the
host architecture. On x32 in particular, it is 8 bytes
long while the long int type is only 4 bytes  long. Hence,
using li as a format specifier will trigger a format
error. Thus, better use PRI_TIME instead of li which is
actually the right format specifier to use for time_t.

(cherry picked from commit 0060bb8f5bbad433bc29405cc76b955d3125d8e9)
---
 src/timesync/timesyncd-manager.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/timesync/timesyncd-manager.c b/src/timesync/timesyncd-manager.c
index 11c495e291..ae8514550a 100644
--- a/src/timesync/timesyncd-manager.c
+++ b/src/timesync/timesyncd-manager.c
@@ -378,7 +378,7 @@ static int manager_adjust_clock(Manager *m, double offset, int leap_sec) {
         m->drift_ppm = tmx.freq / 65536;
 
         log_debug("  status       : %04i %s\n"
-                  "  time now     : %li.%03"PRI_USEC"\n"
+                  "  time now     : %"PRI_TIME".%03"PRI_USEC"\n"
                   "  constant     : %"PRI_TIMEX"\n"
                   "  offset       : %+.3f sec\n"
                   "  freq offset  : %+"PRI_TIMEX" (%i ppm)\n",