[Git][NTPsec/ntpsec][master] Fix a few more warnings.

Hal Murray gitlab at mg.gitlab.com
Tue Dec 1 12:26:15 UTC 2015


Hal Murray pushed to branch master at NTPsec / ntpsec


Commits:
1658d055 by Hal Murray at 2015-12-01T04:25:34Z
Fix a few more warnings.

- - - - -


3 changed files:

- ntpd/ntp_io.c
- ntpd/ntp_proto.c
- ntpd/ntp_signd.c


Changes:

=====================================
ntpd/ntp_io.c
=====================================
--- a/ntpd/ntp_io.c
+++ b/ntpd/ntp_io.c
@@ -348,7 +348,7 @@ maintain_activefds(
 {
 	int i;
 
-	if (fd < 0 || fd >= FD_SETSIZE) {
+	if (fd < 0 || fd >= (int)FD_SETSIZE) {
 		msyslog(LOG_ERR,
 			"Too many sockets in use, FD_SETSIZE %d exceeded by fd %d",
 			FD_SETSIZE, fd);


=====================================
ntpd/ntp_proto.c
=====================================
--- a/ntpd/ntp_proto.c
+++ b/ntpd/ntp_proto.c
@@ -1580,6 +1580,7 @@ process_packet(
 	pleap = PKT_LEAP(pkt->li_vn_mode);
 	pversion = PKT_VERSION(pkt->li_vn_mode);
 	pstratum = PKT_TO_STRATUM(pkt->stratum);
+	if (peer->outcount) peer->outcount--;  /* dup, peer with shorter poll */
 
 	/*
 	 * Capture the header values in the client/peer association..
@@ -1588,7 +1589,7 @@ process_packet(
 	    &peer->dstadr->sin : NULL,
 	    &p_org, &p_rec, &p_xmt, &peer->dst,
 	    pleap, pversion, pmode, pstratum, pkt->ppoll, pkt->precision,
-	    p_del, p_disp, pkt->refid);
+	    p_del, p_disp, pkt->refid, peer->outcount);
 	peer->leap = pleap;
 	peer->stratum = min(pstratum, STRATUM_UNSPEC);
 	peer->pmode = pmode;
@@ -1597,6 +1598,7 @@ process_packet(
 	peer->rootdisp = p_disp;
 	peer->refid = pkt->refid;		/* network byte order */
 	peer->reftime = p_reftime;
+	peer->outcount = 0;
 
 	/*
 	 * First, if either burst mode is armed, enable the burst.
@@ -3119,6 +3121,7 @@ peer_xmit(
 		intercept_sendpkt(__func__, &peer->srcadr, peer->dstadr, sys_ttl[peer->ttl],
 		    &xpkt, sendlen);
 		peer->sent++;
+		peer->outcount++;
 		peer->throttle += (1 << peer->minpoll) - 2;
 
 		/*
@@ -3471,6 +3474,7 @@ peer_xmit(
 
 static void
 leap_smear_add_offs(l_fp *t, l_fp *t_recv) {
+	UNUSED_ARG(t_recv);
 	L_ADD(t, &leap_smear.offset);
 }
 


=====================================
ntpd/ntp_signd.c
=====================================
--- a/ntpd/ntp_signd.c
+++ b/ntpd/ntp_signd.c
@@ -92,7 +92,7 @@ send_packet(int fd, const char *buf, uint32_t len)
 {
 	uint32_t net_len = htonl(len);
 	if (write_all(fd, &net_len, sizeof(net_len)) != sizeof(net_len)) return -1;
-	if (write_all(fd, buf, len) != len) return -1;	
+	if (write_all(fd, buf, len) != (int)len) return -1;
 	return 0;
 }
 
@@ -105,7 +105,7 @@ recv_packet(int fd, char **buf, uint32_t *len)
 	if (read_all(fd, len, sizeof(*len)) != sizeof(*len)) return -1;
 	*len = ntohl(*len);
 	(*buf) = emalloc(*len);
-	if (read_all(fd, *buf, *len) != *len) {
+	if (read_all(fd, *buf, *len) != (int)*len) {
 		free(*buf);
 		return -1;
 	}
@@ -121,6 +121,7 @@ send_via_ntp_signd(
 	struct pkt  *xpkt
 	)
 {
+	UNUSED_ARG(flags);
 	
 	/* We are here because it was detected that the client
 	 * sent an all-zero signature, and we therefore know



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/1658d055daf2d83ed0271ce77c7be9098be1c77e
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20151201/b578b193/attachment.html>


More information about the vc mailing list