path: root/main/chrony/chrony-1.23-sources.diff
blob: 5f39ca3321f196690294c9f34a261ccccdd2e649 (plain) (tree)

commit 2f2446c7dc074b2d1728a5e3f7a600c10cea2425
Author: Goswin Brederlow <brederlo@informatik.uni-tuebingen.de>
Date:   Sat Mar 29 20:49:59 2008 +0000

    Fix for chronyc "sources" command on 64 bit machines
    (Taken from
    Attached is a patchlet to make the "sources" command of chrony output properly
    signed numbers. The chronyd code (see e.g. ntp.h) properly uses int32_t and
    friends to get the right number of bits per datatype while client.c just uses
    short, int, long. But long will be 64 bit or 32 bit depending on the cpu.

diff --git a/client.c b/client.c
index b7e5bcb..85d6e84 100644
--- a/client.c
+++ b/client.c
@@ -45,6 +45,12 @@
 #include <readline/history.h>
+#ifdef HAS_STDINT_H
+#include <stdint.h>
+#elif defined(HAS_INTTYPES_H)
+#include <inttypes.h>
 /* ================================================== */
 static int sock_fd;
@@ -1383,16 +1389,16 @@ process_cmd_sources(char *line)
   int n_sources, i;
   int verbose = 0;
-  long orig_latest_meas, latest_meas, est_offset;
-  unsigned long ip_addr;
-  unsigned long latest_meas_err, est_offset_err;
-  unsigned long latest_meas_ago;
-  unsigned short poll, stratum;
-  unsigned short state, mode;
+  int32_t orig_latest_meas, latest_meas, est_offset;
+  uint32_t ip_addr;
+  uint32_t latest_meas_err, est_offset_err;
+  uint32_t latest_meas_ago;
+  uint16_t poll, stratum;
+  uint16_t state, mode;
   double resid_freq, resid_skew;
   const char *dns_lookup;
   char hostname_buf[32];
-  unsigned short status;
+  uint16_t status;
   /* Check whether to output verbose headers */
   verbose = check_for_verbose_flag(line);