mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-29 16:44:03 +00:00
In usr.sbin/timed, fix several issues with printf formats:
- Cast time_t's to long, and print them with %ld. - Print ptrdiff_t's with %td. - Print ssize_t's and size_t's with %zd and %zu. - Print int32_t's with %d. Also, replace some int variables with the more appropriate size_t. MFC after: 1 week
This commit is contained in:
parent
3803473797
commit
ad5b59d82c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=228714
@ -163,7 +163,7 @@ adjclock(corr)
|
||||
} else {
|
||||
syslog(LOG_WARNING,
|
||||
"clock correction %ld sec too large to adjust",
|
||||
adj.tv_sec);
|
||||
(long)adj.tv_sec);
|
||||
(void) gettimeofday(&now, 0);
|
||||
timevaladd(&now, corr);
|
||||
if (settimeofday(&now, 0) < 0)
|
||||
|
@ -137,7 +137,7 @@ networkdelta()
|
||||
}
|
||||
|
||||
if (trace)
|
||||
fprintf(fd, "median of %d values starting at %ld is ",
|
||||
fprintf(fd, "median of %td values starting at %ld is ",
|
||||
xp-&x[0], med);
|
||||
return median(med, &eps, &x[0], xp, 1);
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ readmsg(type, machfrom, intvl, netfrom)
|
||||
|
||||
if (trace) {
|
||||
fprintf(fd, "readmsg: wait %ld.%6ld at %s\n",
|
||||
rwait.tv_sec, rwait.tv_usec, date());
|
||||
(long)rwait.tv_sec, rwait.tv_usec, date());
|
||||
/* Notice a full disk, as we flush trace info.
|
||||
* It is better to flush periodically than at
|
||||
* every line because the tracing consists of bursts
|
||||
@ -214,7 +214,7 @@ readmsg(type, machfrom, intvl, netfrom)
|
||||
*/
|
||||
if (n < (ssize_t)(sizeof(struct tsp) - MAXHOSTNAMELEN + 32)) {
|
||||
syslog(LOG_NOTICE,
|
||||
"short packet (%u/%u bytes) from %s",
|
||||
"short packet (%zd/%zu bytes) from %s",
|
||||
n, sizeof(struct tsp) - MAXHOSTNAMELEN + 32,
|
||||
inet_ntoa(from.sin_addr));
|
||||
continue;
|
||||
@ -486,7 +486,7 @@ print(msg, addr)
|
||||
break;
|
||||
|
||||
case TSP_ADJTIME:
|
||||
fprintf(fd, "%s %d %-6u (%ld,%ld) %-15s %s\n",
|
||||
fprintf(fd, "%s %d %-6u (%d,%d) %-15s %s\n",
|
||||
tsptype[msg->tsp_type],
|
||||
msg->tsp_vers,
|
||||
msg->tsp_seq,
|
||||
|
@ -267,7 +267,7 @@ msite(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
int cc;
|
||||
ssize_t cc;
|
||||
fd_set ready;
|
||||
struct sockaddr_in dest;
|
||||
int i, length;
|
||||
@ -333,7 +333,7 @@ msite(argc, argv)
|
||||
*/
|
||||
if (cc < (sizeof(struct tsp) - MAXHOSTNAMELEN + 32)) {
|
||||
fprintf(stderr,
|
||||
"short packet (%u/%u bytes) from %s\n",
|
||||
"short packet (%zd/%zu bytes) from %s\n",
|
||||
cc, sizeof(struct tsp) - MAXHOSTNAMELEN + 32,
|
||||
inet_ntoa(from.sin_addr));
|
||||
continue;
|
||||
@ -428,7 +428,7 @@ tracing(argc, argv)
|
||||
{
|
||||
int onflag;
|
||||
int length;
|
||||
int cc;
|
||||
ssize_t cc;
|
||||
fd_set ready;
|
||||
struct sockaddr_in dest;
|
||||
struct sockaddr_in from;
|
||||
@ -489,7 +489,7 @@ tracing(argc, argv)
|
||||
* least long enough to hold a 4.3BSD packet.
|
||||
*/
|
||||
if (cc < (sizeof(struct tsp) - MAXHOSTNAMELEN + 32)) {
|
||||
fprintf(stderr, "short packet (%u/%u bytes) from %s\n",
|
||||
fprintf(stderr, "short packet (%zd/%zu bytes) from %s\n",
|
||||
cc, sizeof(struct tsp) - MAXHOSTNAMELEN + 32,
|
||||
inet_ntoa(from.sin_addr));
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user