From: Andreas Henriksson <andreas@fatal.se>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: netdev@vger.kernel.org
Subject: [PATCH] iproute2: fix build failure on sparc due to -Wformat and tv_usec
Date: Sat, 18 May 2013 18:18:51 +0200 [thread overview]
Message-ID: <20130518161850.GA16019@amd64.fatal.se> (raw)
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>
---
lib/utils.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/utils.c b/lib/utils.c
index bcd6002..dae1b51 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;
}
--
1.7.10.4
next reply other threads:[~2013-05-18 16:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-18 16:18 Andreas Henriksson [this message]
2013-06-04 2:58 ` [PATCH] iproute2: fix build failure on sparc due to -Wformat and tv_usec Stephen Hemminger
2013-06-25 20:37 ` Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130518161850.GA16019@amd64.fatal.se \
--to=andreas@fatal.se \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).