From d54d60dd3d89667ba4fbdc7adeaeac4bd7094197 Mon Sep 17 00:00:00 2001 From: brian Date: Fri, 3 Mar 2000 21:52:56 +0000 Subject: [PATCH] Fix some printf-type argument bugs --- usr.sbin/ppp/ppp/bundle.c | 18 ++++++++++-------- usr.sbin/ppp/ppp/ipcp.c | 5 +++-- usr.sbin/ppp/ppp/mbuf.c | 8 ++++---- usr.sbin/ppp/ppp/nat_cmd.c | 6 +++--- usr.sbin/ppp/ppp/physical.c | 6 +++--- usr.sbin/ppp/ppp/slcompress.c | 6 +++--- 6 files changed, 26 insertions(+), 23 deletions(-) diff --git a/usr.sbin/ppp/ppp/bundle.c b/usr.sbin/ppp/ppp/bundle.c index d4c04168d94..9506055509c 100644 --- a/usr.sbin/ppp/ppp/bundle.c +++ b/usr.sbin/ppp/ppp/bundle.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $OpenBSD: bundle.c,v 1.30 2000/02/27 01:38:24 brian Exp $ + * $OpenBSD: bundle.c,v 1.31 2000/03/03 21:52:56 brian Exp $ */ #include @@ -1439,14 +1439,15 @@ bundle_ReceiveDatalink(struct bundle *bundle, int s) msg.msg_control = cmsgbuf; msg.msg_controllen = sizeof cmsgbuf; - log_Printf(LogDEBUG, "Expecting %d scatter/gather bytes\n", iov[0].iov_len); + log_Printf(LogDEBUG, "Expecting %u scatter/gather bytes\n", + (unsigned)iov[0].iov_len); if ((got = recvmsg(s, &msg, MSG_WAITALL)) != iov[0].iov_len) { if (got == -1) log_Printf(LogERROR, "Failed recvmsg: %s\n", strerror(errno)); else - log_Printf(LogERROR, "Failed recvmsg: Got %d, not %d\n", - got, iov[0].iov_len); + log_Printf(LogERROR, "Failed recvmsg: Got %d, not %u\n", + got, (unsigned)iov[0].iov_len); while (niov--) free(iov[niov].iov_base); return; @@ -1623,15 +1624,16 @@ bundle_SendDatalink(struct datalink *dl, int s, struct sockaddr_un *sun) log_Printf(LogERROR, "setsockopt(SO_RCVBUF, %d): %s\n", expect, strerror(errno)); - log_Printf(LogDEBUG, "Sending %d descriptor%s and %d bytes in scatter" - "/gather array\n", nfd, nfd == 1 ? "" : "s", iov[0].iov_len); + log_Printf(LogDEBUG, "Sending %d descriptor%s and %u bytes in scatter" + "/gather array\n", nfd, nfd == 1 ? "" : "s", + (unsigned)iov[0].iov_len); if ((got = sendmsg(s, &msg, 0)) == -1) log_Printf(LogERROR, "Failed sendmsg: %s: %s\n", sun->sun_path, strerror(errno)); else if (got != iov[0].iov_len) - log_Printf(LogERROR, "%s: Failed initial sendmsg: Only sent %d of %d\n", - sun->sun_path, got, iov[0].iov_len); + log_Printf(LogERROR, "%s: Failed initial sendmsg: Only sent %d of %u\n", + sun->sun_path, got, (unsigned)iov[0].iov_len); else { /* We must get the ACK before closing the descriptor ! */ int res; diff --git a/usr.sbin/ppp/ppp/ipcp.c b/usr.sbin/ppp/ppp/ipcp.c index 0505d95f19e..78c86c42b8b 100644 --- a/usr.sbin/ppp/ppp/ipcp.c +++ b/usr.sbin/ppp/ppp/ipcp.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $OpenBSD: ipcp.c,v 1.21 2000/02/27 01:38:26 brian Exp $ + * $OpenBSD: ipcp.c,v 1.22 2000/03/03 21:52:57 brian Exp $ * * TODO: * o Support IPADDRS properly @@ -371,7 +371,8 @@ ipcp_Show(struct cmdargs const *arg) inet_ntoa(ipcp->peer_ip), vj2asc(ipcp->peer_compproto)); prompt_Printf(arg->prompt, " My side: %s, %s\n", inet_ntoa(ipcp->my_ip), vj2asc(ipcp->my_compproto)); - prompt_Printf(arg->prompt, " Queued packets: %d\n", ip_QueueLen(ipcp)); + prompt_Printf(arg->prompt, " Queued packets: %lu\n", + (unsigned long)ip_QueueLen(ipcp)); } if (ipcp->route) { diff --git a/usr.sbin/ppp/ppp/mbuf.c b/usr.sbin/ppp/ppp/mbuf.c index 6d25f004f3a..40f769b0517 100644 --- a/usr.sbin/ppp/ppp/mbuf.c +++ b/usr.sbin/ppp/ppp/mbuf.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $OpenBSD: mbuf.c,v 1.10 2000/02/27 01:38:27 brian Exp $ + * $OpenBSD: mbuf.c,v 1.11 2000/03/03 21:52:57 brian Exp $ * */ #include @@ -112,8 +112,8 @@ m_get(size_t m_len, int type) */ *mb = (struct mbucket *)malloc(BUCKET_CHUNK * size); if (*mb == NULL) { - log_Printf(LogALERT, "Failed to allocate memory (%u)\n", - BUCKET_CHUNK * size); + log_Printf(LogALERT, "Failed to allocate memory (%lu)\n", + (unsigned long)BUCKET_CHUNK * size); AbortProgram(EX_OSERR); } bp = &(*mb)->u.m; @@ -354,7 +354,7 @@ m_enqueue(struct mqueue *queue, struct mbuf *bp) } else queue->last = queue->top = bp; queue->len++; - log_Printf(LogDEBUG, "m_enqueue: len = %d\n", queue->len); + log_Printf(LogDEBUG, "m_enqueue: len = %lu\n", (unsigned long)queue->len); } } diff --git a/usr.sbin/ppp/ppp/nat_cmd.c b/usr.sbin/ppp/ppp/nat_cmd.c index 4122e77bfa3..44e66c39951 100644 --- a/usr.sbin/ppp/ppp/nat_cmd.c +++ b/usr.sbin/ppp/ppp/nat_cmd.c @@ -2,7 +2,7 @@ * The code in this file was written by Eivind Eklund , * who places it in the public domain without restriction. * - * $OpenBSD: nat_cmd.c,v 1.3 2000/02/27 01:38:27 brian Exp $ + * $OpenBSD: nat_cmd.c,v 1.4 2000/03/03 21:52:57 brian Exp $ */ #include @@ -383,8 +383,8 @@ nat_LayerPull(struct bundle *bundle, struct link *l, struct mbuf *bp, bp->m_len = ntohs(pip->ip_len); if (bp->m_len > MAX_MRU) { - log_Printf(LogWARN, "nat_LayerPull: Problem with IP header length (%d)\n", - bp->m_len); + log_Printf(LogWARN, "nat_LayerPull: Problem with IP header length (%lu)\n", + (unsigned long)bp->m_len); m_freem(bp); return NULL; } diff --git a/usr.sbin/ppp/ppp/physical.c b/usr.sbin/ppp/ppp/physical.c index 384e45e431d..5a64533d0e3 100644 --- a/usr.sbin/ppp/ppp/physical.c +++ b/usr.sbin/ppp/ppp/physical.c @@ -16,7 +16,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $OpenBSD: physical.c,v 1.20 2000/02/27 01:38:27 brian Exp $ + * $OpenBSD: physical.c,v 1.21 2000/03/03 21:52:57 brian Exp $ * */ @@ -385,8 +385,8 @@ physical_DescriptorWrite(struct fdescriptor *d, struct bundle *bundle, if (p->out) { nw = physical_Write(p, MBUF_CTOP(p->out), p->out->m_len); - log_Printf(LogDEBUG, "%s: DescriptorWrite: wrote %d(%d) to %d\n", - p->link.name, nw, p->out->m_len, p->fd); + log_Printf(LogDEBUG, "%s: DescriptorWrite: wrote %d(%lu) to %d\n", + p->link.name, nw, (unsigned long)p->out->m_len, p->fd); if (nw > 0) { p->out->m_len -= nw; p->out->m_offset += nw; diff --git a/usr.sbin/ppp/ppp/slcompress.c b/usr.sbin/ppp/ppp/slcompress.c index 0b39ef848ff..cdf473903b9 100644 --- a/usr.sbin/ppp/ppp/slcompress.c +++ b/usr.sbin/ppp/ppp/slcompress.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $OpenBSD: slcompress.c,v 1.11 2000/02/27 01:38:28 brian Exp $ + * $OpenBSD: slcompress.c,v 1.12 2000/03/03 21:52:57 brian Exp $ * * Van Jacobson (van@helios.ee.lbl.gov), Dec 31, 1989: * - Initial distribution. @@ -154,8 +154,8 @@ sl_compress_tcp(struct mbuf * m, * the caller has already made sure the packet is IP proto TCP). */ if ((ip->ip_off & htons(0x3fff)) || m->m_len < 40) { - log_Printf(LogDEBUG, "??? 1 ip_off = %x, m_len = %d\n", - ip->ip_off, m->m_len); + log_Printf(LogDEBUG, "??? 1 ip_off = %x, m_len = %lu\n", + ip->ip_off, (unsigned long)m->m_len); log_DumpBp(LogDEBUG, "", m); return (TYPE_IP); } -- 2.20.1