diff options
author | yar <yar@FreeBSD.org> | 2006-07-28 16:09:19 +0000 |
---|---|---|
committer | yar <yar@FreeBSD.org> | 2006-07-28 16:09:19 +0000 |
commit | e1db503689ae54aa3513f73b6e1aa4212ded2641 (patch) | |
tree | a96eb543030e3d44f3753ab7e82506f8d20fb99b /usr.bin/netstat/mroute.c | |
parent | aa2529c0155cd13a19220e5ce17be7a511f54099 (diff) | |
download | FreeBSD-src-e1db503689ae54aa3513f73b6e1aa4212ded2641.zip FreeBSD-src-e1db503689ae54aa3513f73b6e1aa4212ded2641.tar.gz |
Achieve WARNS=2 by using uintmax_t to pass around 64-bit quantities,
including to printf(). Using uintmax_t is also robust to further
extensions in both the C language and the bitwidth of kernel counters.
Tested on: i386 amd64 ia64
Diffstat (limited to 'usr.bin/netstat/mroute.c')
-rw-r--r-- | usr.bin/netstat/mroute.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.bin/netstat/mroute.c b/usr.bin/netstat/mroute.c index 4b73005..6a60582 100644 --- a/usr.bin/netstat/mroute.c +++ b/usr.bin/netstat/mroute.c @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$"); #include <netinet/ip_mroute.h> #include <err.h> +#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include "netstat.h" @@ -207,11 +208,11 @@ print_bw_meter(struct bw_meter *bw_meter, int *banner_printed) /* The measured values */ if (bw_meter->bm_flags & BW_METER_UNIT_PACKETS) - sprintf(s1, "%llu", bw_meter->bm_measured.b_packets); + sprintf(s1, "%ju", (uintmax_t)bw_meter->bm_measured.b_packets); else sprintf(s1, "?"); if (bw_meter->bm_flags & BW_METER_UNIT_BYTES) - sprintf(s2, "%llu", bw_meter->bm_measured.b_bytes); + sprintf(s2, "%ju", (uintmax_t)bw_meter->bm_measured.b_bytes); else sprintf(s2, "?"); sprintf(s0, "%lu.%lu|%s|%s", @@ -230,11 +231,11 @@ print_bw_meter(struct bw_meter *bw_meter, int *banner_printed) /* The threshold values */ if (bw_meter->bm_flags & BW_METER_UNIT_PACKETS) - sprintf(s1, "%llu", bw_meter->bm_threshold.b_packets); + sprintf(s1, "%ju", (uintmax_t)bw_meter->bm_threshold.b_packets); else sprintf(s1, "?"); if (bw_meter->bm_flags & BW_METER_UNIT_BYTES) - sprintf(s2, "%llu", bw_meter->bm_threshold.b_bytes); + sprintf(s2, "%ju", (uintmax_t)bw_meter->bm_threshold.b_bytes); else sprintf(s2, "?"); sprintf(s0, "%lu.%lu|%s|%s", |