Fix some printf-format issues.
This commit is contained in:
parent
45af90e98a
commit
f3810d710b
|
@ -203,7 +203,7 @@ SimFile_Open(struct ocx *ocx, const char *fn, struct todolist *tdl,
|
|||
break;
|
||||
case 2:
|
||||
if (sscanf(buf, "# Peer %s %s", buf2, buf3) != 2)
|
||||
Fail(ocx, 0, "Expected '# Peer' line", fpeer);
|
||||
Fail(ocx, 0, "Expected '# Peer' line");
|
||||
|
||||
np = NTP_Peer_NewLookup(ocx, buf3);
|
||||
AN(np);
|
||||
|
|
6
ntimed.h
6
ntimed.h
|
@ -49,14 +49,16 @@ enum ocx_chan {
|
|||
OCX_DEBUG, // think: stdout
|
||||
};
|
||||
|
||||
void Put(struct ocx *, enum ocx_chan, const char *, ...);
|
||||
void Put(struct ocx *, enum ocx_chan, const char *, ...)
|
||||
__printflike(3, 4);
|
||||
void PutHex(struct ocx *, enum ocx_chan, const void *, ssize_t len);
|
||||
|
||||
/*
|
||||
* Report "Failure: " + args + "\n" [+ errno-line] + "\n". exit(1);
|
||||
*/
|
||||
void Fail(struct ocx *, int err, const char *, ...) \
|
||||
__attribute__((__noreturn__));
|
||||
__attribute__((__noreturn__))
|
||||
__printflike(3, 4);
|
||||
|
||||
#define Debug(ocx, ...) Put(ocx, OCX_DEBUG, __VA_ARGS__)
|
||||
#define DebugHex(ocx, ptr, len) PutHex(ocx, OCX_DEBUG, ptr, len)
|
||||
|
|
|
@ -85,6 +85,14 @@
|
|||
*/
|
||||
#define __match_proto__(xxx) /*lint -e{818} */
|
||||
|
||||
/**********************************************************************
|
||||
* Compiler tricks
|
||||
*/
|
||||
|
||||
#ifndef __printflike
|
||||
#define __printflike(a, b)
|
||||
#endif
|
||||
|
||||
/**********************************************************************
|
||||
* Mini object type checking
|
||||
*
|
||||
|
|
|
@ -69,7 +69,7 @@ nf_filter(struct ocx *ocx, const struct ntp_peer *np)
|
|||
|
||||
NTP_Tool_Format(buf, sizeof buf, rxp);
|
||||
|
||||
Put(NULL, OCX_TRACE, "NTP_Packet %+f %s %s %s\n",
|
||||
Put(NULL, OCX_TRACE, "NTP_Packet %s %s %s\n",
|
||||
np->hostname, np->ip, buf);
|
||||
|
||||
if (rxp->ntp_leap == NTP_LEAP_UNKNOWN)
|
||||
|
|
|
@ -124,7 +124,7 @@ NTP_Peer_Poll(struct ocx *ocx, int fd, const struct ntp_peer *np, double tmo)
|
|||
l = sendto(fd, buf, len, 0, np->sa, np->sa_len);
|
||||
if (l != len)
|
||||
Fail(ocx, l < 0 ? 1 : 0,
|
||||
"Tx peer '%s' @%s got %d", np->hostname, np->ip, l);
|
||||
"Tx peer %s %s got %zd", np->hostname, np->ip, l);
|
||||
|
||||
(void)TB_Now(&t0);
|
||||
|
||||
|
@ -155,8 +155,8 @@ NTP_Peer_Poll(struct ocx *ocx, int fd, const struct ntp_peer *np, double tmo)
|
|||
Fail(ocx, 1, "Rx failed\n");
|
||||
|
||||
if (i != 48) {
|
||||
Debug(ocx, "Rx peer %s @%s got len=%d\n",
|
||||
np->hostname, i);
|
||||
Debug(ocx, "Rx peer %s %s got len=%d\n",
|
||||
np->hostname, np->ip, i);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue