Fix some printf-style argument bugs

This commit is contained in:
brian 2000-03-14 01:47:19 +00:00
parent 75fdce32f8
commit d915279bc0
6 changed files with 20 additions and 17 deletions

View File

@ -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;

View File

@ -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) {

View File

@ -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);
}
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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);
}