commit 2f2446c7dc074b2d1728a5e3f7a600c10cea2425 Author: Goswin Brederlow 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 #endif +#ifdef HAS_STDINT_H +#include +#elif defined(HAS_INTTYPES_H) +#include +#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);