]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
cmdmon: fix doffset command with negative values on 64-bit systems
authorMiroslav Lichvar <mlichvar@redhat.com>
Mon, 28 Apr 2014 11:20:41 +0000 (13:20 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Mon, 28 Apr 2014 12:12:05 +0000 (14:12 +0200)
cmdmon.c

index e3ec9e09129bf6c608232d06fece25570d521a84..b056770016d448f3e415eac42898e5c6215daf74 100644 (file)
--- a/cmdmon.c
+++ b/cmdmon.c
@@ -1378,8 +1378,8 @@ handle_doffset(CMD_Request *rx_message, CMD_Reply *tx_message)
 {
   long sec, usec;
   double doffset;
-  sec = (long)(ntohl(rx_message->data.doffset.sec));
-  usec = (long)(ntohl(rx_message->data.doffset.usec));
+  sec = (int32_t)ntohl(rx_message->data.doffset.sec);
+  usec = (int32_t)ntohl(rx_message->data.doffset.usec);
   doffset = (double) sec + 1.0e-6 * (double) usec;
   LOG(LOGS_INFO, LOGF_CmdMon, "Accumulated delta offset of %.6f seconds", doffset);
   LCL_AccumulateOffset(doffset, 0.0);