summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Henriksson <andreas@fatal.se>2013-05-18 06:18:51 +0000
committerStephen Hemminger <stephen@networkplumber.org>2013-06-03 19:56:25 -0700
commitc083d99dd3825e2f7a66d3e4717ed3fc6c42f351 (patch)
tree706bc593a25c8fef3236d020ddfd6d131e6de172
parenta40d0827a58b3de39c8557db13f8a285813abd40 (diff)
iproute2: fix build failure on sparc due to -Wformat and tv_usec
tv_usec is "suseconds_t" which is apparently usually a signed long, but sometimes not.... Change the printf modifier to use signed and cast the tv_usec to long in case it's not already long. gcc -Wall -Wstrict-prototypes -Werror -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -O2 -I../include -DRESOLVE_HOSTNAMES -DLIBDIR=\"/usr/lib\" -DCONFDIR=\"/etc/iproute2\" -D_GNU_SOURCE -fPIC -c -o utils.o utils.c utils.c: In function 'print_timestamp': utils.c:802:2: error: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type '__suseconds_t' [-Werror=format] cc1: all warnings being treated as errors Signed-off-by: Andreas Henriksson <andreas@fatal.se>
-rw-r--r--lib/utils.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/utils.c b/lib/utils.c
index bcd60023..dae1b518 100644
--- a/lib/utils.c
+++ b/lib/utils.c
@@ -799,7 +799,7 @@ int print_timestamp(FILE *fp)
tstr = asctime(localtime(&tv.tv_sec));
tstr[strlen(tstr)-1] = 0;
- fprintf(fp, "Timestamp: %s %lu usec\n", tstr, tv.tv_usec);
+ fprintf(fp, "Timestamp: %s %ld usec\n", tstr, (long)tv.tv_usec);
return 0;
}