Blob Blame History Raw
diff -up ntp-4.2.6p4/ntpstat-0.2/ntpstat.c.errorbit ntp-4.2.6p4/ntpstat-0.2/ntpstat.c
--- ntp-4.2.6p4/ntpstat-0.2/ntpstat.c.errorbit	2011-10-06 13:41:38.591669772 +0200
+++ ntp-4.2.6p4/ntpstat-0.2/ntpstat.c	2011-10-06 16:50:01.708315811 +0200
@@ -104,6 +104,7 @@ int main (void) {
   FD_ZERO(&fds);
 
   inet_aton("127.0.0.1", &address);
+  memset(&sock, 0, sizeof (sock));;
   sock.sin_family = AF_INET;
   sock.sin_addr = address;
   sock.sin_port = htons(NTP_PORT);
@@ -159,15 +160,18 @@ int main (void) {
     die ("return data appears to be invalid based on status word");
   }
 
-  if (!(ntpmsg.byte2 | EMASK)) {
+  if (ntpmsg.byte2 & EMASK) {
     fprintf (stderr,"status byte2 is %02x\n", ntpmsg.byte2 );
     die ("error bit is set in reply");
   }
 
-  if (!(ntpmsg.byte2 | MMASK)) {
+  /* ignore the more bit */
+#if 0
+  if (ntpmsg.byte2 & MMASK) {
     fprintf (stderr,"status byte2 is %02x\n", ntpmsg.byte2 );
     fprintf (stderr,"More bit unexpected in reply");
   }
+#endif
 
   /* if the leap indicator (LI), which is the two most significant bits
      in status byte1, are both one, then the clock is not synchronised. */