patch-ntp_c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. --- rdate.orig/ntp.c 2007-08-17 17:03:24.000000000 +0200
  2. +++ rdate/ntp.c 2013-12-30 23:07:06.000000000 +0100
  3. @@ -37,6 +37,7 @@
  4. #include <sys/time.h>
  5. #include <netinet/in.h>
  6. #include <arpa/inet.h>
  7. +#include <sys/types.h>
  8. #include <ctype.h>
  9. #include <err.h>
  10. @@ -100,9 +101,9 @@ struct ntp_data {
  11. double transmit;
  12. double current;
  13. double originate;
  14. - u_int64_t xmitck;
  15. - u_int64_t recvck;
  16. - u_int32_t refid;
  17. + uint64_t xmitck;
  18. + uint64_t recvck;
  19. + uint32_t refid;
  20. u_char status;
  21. u_char version;
  22. u_char mode;
  23. @@ -268,7 +269,7 @@ write_packet(int fd, struct ntp_data *da
  24. packet[0] = ((nver ? nver : NTP_VERSION) << 3) | (NTP_MODE_CLIENT);
  25. - data->xmitck = (u_int64_t)arc4random() << 32 | arc4random();
  26. + data->xmitck = (uint64_t)arc4random() << 32 | arc4random();
  27. /*
  28. * Send out a random 64-bit number as our transmit time. The NTP
  29. @@ -286,7 +287,7 @@ write_packet(int fd, struct ntp_data *da
  30. * the transmit field intelligible.
  31. */
  32. - memcpy(packet + NTP_TRANSMIT, &data->xmitck, sizeof (u_int64_t));
  33. + memcpy(packet + NTP_TRANSMIT, &data->xmitck, sizeof (uint64_t));
  34. data->originate = current_time(JAN_1970);
  35. @@ -437,7 +438,7 @@ unpack_ntp(struct ntp_data *data, u_char
  36. data->transmit = d / NTP_SCALE;
  37. /* See write_packet for why this isn't an endian problem. */
  38. - memcpy(&data->recvck, packet + NTP_ORIGINATE, sizeof (u_int64_t));
  39. + memcpy(&data->recvck, packet + NTP_ORIGINATE, sizeof (uint64_t));
  40. }
  41. /*