teknoraver / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone

Blame 0042-timesync-timesyncd-manager-fix-format-specifier-issu.patch

Zbigniew Jędrzejewski-Szmek d743bb
From 416ca19f3149e44fee7fee2df9b8e63042076fda Mon Sep 17 00:00:00 2001
Zbigniew Jędrzejewski-Szmek d743bb
From: Matija Skala <mskala@gmx.com>
Zbigniew Jędrzejewski-Szmek d743bb
Date: Fri, 19 May 2017 14:36:40 +0200
Zbigniew Jędrzejewski-Szmek d743bb
Subject: [PATCH] timesync/timesyncd-manager: fix format-specifier issue
Zbigniew Jędrzejewski-Szmek d743bb
Zbigniew Jędrzejewski-Szmek d743bb
timex::time::tv_sec can have different sizes depending on the
Zbigniew Jędrzejewski-Szmek d743bb
host architecture. On x32 in particular, it is 8 bytes
Zbigniew Jędrzejewski-Szmek d743bb
long while the long int type is only 4 bytes  long. Hence,
Zbigniew Jędrzejewski-Szmek d743bb
using li as a format specifier will trigger a format
Zbigniew Jędrzejewski-Szmek d743bb
error. Thus, better use PRI_TIME instead of li which is
Zbigniew Jędrzejewski-Szmek d743bb
actually the right format specifier to use for time_t.
Zbigniew Jędrzejewski-Szmek d743bb
Zbigniew Jędrzejewski-Szmek d743bb
(cherry picked from commit 0060bb8f5bbad433bc29405cc76b955d3125d8e9)
Zbigniew Jędrzejewski-Szmek d743bb
---
Zbigniew Jędrzejewski-Szmek d743bb
 src/timesync/timesyncd-manager.c | 2 +-
Zbigniew Jędrzejewski-Szmek d743bb
 1 file changed, 1 insertion(+), 1 deletion(-)
Zbigniew Jędrzejewski-Szmek d743bb
Zbigniew Jędrzejewski-Szmek d743bb
diff --git a/src/timesync/timesyncd-manager.c b/src/timesync/timesyncd-manager.c
Zbigniew Jędrzejewski-Szmek d743bb
index 11c495e291..ae8514550a 100644
Zbigniew Jędrzejewski-Szmek d743bb
--- a/src/timesync/timesyncd-manager.c
Zbigniew Jędrzejewski-Szmek d743bb
+++ b/src/timesync/timesyncd-manager.c
Zbigniew Jędrzejewski-Szmek d743bb
@@ -378,7 +378,7 @@ static int manager_adjust_clock(Manager *m, double offset, int leap_sec) {
Zbigniew Jędrzejewski-Szmek d743bb
         m->drift_ppm = tmx.freq / 65536;
Zbigniew Jędrzejewski-Szmek d743bb
 
Zbigniew Jędrzejewski-Szmek d743bb
         log_debug("  status       : %04i %s\n"
Zbigniew Jędrzejewski-Szmek d743bb
-                  "  time now     : %li.%03"PRI_USEC"\n"
Zbigniew Jędrzejewski-Szmek d743bb
+                  "  time now     : %"PRI_TIME".%03"PRI_USEC"\n"
Zbigniew Jędrzejewski-Szmek d743bb
                   "  constant     : %"PRI_TIMEX"\n"
Zbigniew Jędrzejewski-Szmek d743bb
                   "  offset       : %+.3f sec\n"
Zbigniew Jędrzejewski-Szmek d743bb
                   "  freq offset  : %+"PRI_TIMEX" (%i ppm)\n",