aboutsummaryrefslogtreecommitdiffstats
path: root/main/chrony/chrony-1.23-sources.diff
blob: 5f39ca3321f196690294c9f34a261ccccdd2e649 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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
      http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=348412
    )
    
    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>
 #endif
 
+#ifdef HAS_STDINT_H
+#include <stdint.h>
+#elif defined(HAS_INTTYPES_H)
+#include <inttypes.h>
+#endif
+
 /* ================================================== */
 
 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);