[Nagiosplug-checkins] nagiosplug/plugins check_ntp.c,1.11,1.12

M. Sean Finney seanius at users.sourceforge.net
Sat Jan 20 11:59:27 CET 2007


Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv5762

Modified Files:
	check_ntp.c 
Log Message:
compilation fixes for check_ntp.c:
- check_ntp.c:290: warning: overflow in implicit constant conversion
  fixed with an explicit cast to int8_t.
- check_ntp.c:544: warning: pointer of type ‘void *’ used in arithmetic
  fixed by casting to ptrdiff_t before arithmetic and (void*) afterwards
- in TVtoNTP64, cast arithmetic result passed to R32 as uint64_t.


Index: check_ntp.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_ntp.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- check_ntp.c	19 Oct 2006 00:25:16 -0000	1.11
+++ check_ntp.c	20 Jan 2007 10:59:25 -0000	1.12
@@ -191,7 +191,7 @@
 	do{ if(!t.tv_usec && !t.tv_sec) n=0x0UL; \
 		else { \
 			L32(n)=htonl(t.tv_sec + EPOCHDIFF); \
-			R32(n)=htonl((4294.967296*t.tv_usec)+.5); \
+			R32(n)=htonl((uint64_t)((4294.967296*t.tv_usec)+.5)); \
 		} \
 	} while(0)
 
@@ -287,7 +287,7 @@
 	VN_SET(p->flags, 4);
 	MODE_SET(p->flags, MODE_CLIENT);
 	p->poll=4;
-	p->precision=0xfa;
+	p->precision=(int8_t)0xfa;
 	L16(p->rtdelay)=htons(1);
 	L16(p->rtdisp)=htons(1);
 
@@ -541,7 +541,7 @@
 	 	 */
 		npeers+=(ntohs(req.count)/sizeof(ntp_assoc_status_pair));
 		peers=(ntp_assoc_status_pair*)realloc(peers, sizeof(ntp_assoc_status_pair)*npeers);
-		memcpy((void*)peers+peer_offset, (void*)req.data, sizeof(ntp_assoc_status_pair)*npeers);
+		memcpy((void*)((ptrdiff_t)peers+peer_offset), (void*)req.data, sizeof(ntp_assoc_status_pair)*npeers);
 		peer_offset+=ntohs(req.count);
 	} while(req.op&REM_MORE);
 





More information about the Commits mailing list