linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iw: event: fix printf format error
@ 2023-01-21 19:36 Stefan Weil
  0 siblings, 0 replies; only message in thread
From: Stefan Weil @ 2023-01-21 19:36 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, Stefan Weil

tv_usec can be a 64 bit integer which causes a compiler warning:

event.c: In function 'print_event':
event.c:930:41: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'suseconds_t' {aka 'long long int'} [-Wformat=]
  930 |                         printf("[%s.%06lu]: ", buf, args->ts.tv_usec);
      |                                     ~~~~^           ~~~~~~~~~~~~~~~~
      |                                         |                   |
      |                                         long unsigned int   suseconds_t {aka long long int}
      |                                     %06llu

Signed-off-by: Stefan Weil <sw@weilnetz.de>
---

I got this compiler warning when building gluon for arm_cortex-a7.

 event.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/event.c b/event.c
index 4c37297..fa2e125 100644
--- a/event.c
+++ b/event.c
@@ -942,7 +942,7 @@ static int print_event(struct nl_msg *msg, void *arg)
 
 			memset(buf, 0, 255);
 			strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", tm);
-			printf("[%s.%06lu]: ", buf, args->ts.tv_usec);
+			printf("[%s.%06lu]: ", buf, (unsigned long )args->ts.tv_usec);
 		} else {
 			printf("%llu.%06llu: ", usecs/1000000, usecs % 1000000);
 		}
-- 
2.37.1 (Apple Git-137.1)


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-01-21 19:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-21 19:36 [PATCH] iw: event: fix printf format error Stefan Weil

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).