batctl: tcpdump: Fix printing of usecs
PATCH 1/1 batctl: tcpdump: Fix printing of usecs
musl on a 32 bit system still uses a 64-bit value (long long) for the storage of microseconds. But the printf was evaluating this argument always only as long.
During the print of this usec value, range of 0-999_999 is only possible. 20 bit is therefore enough to store this range. For simplicity, just use an unsigned int.
Signed-off-by Sven Eckelmann <[email protected]>
--- tcpdump.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tcpdump.c +2 -1
@@ -102,7 +102,8 @@ static int print_time(void) tm =localtime (&tv.tv_sec);if (tm) -printf ("%02d:%02d:%02d.%06ld " , tm->tm_hour, tm->tm_min, tm->tm_sec, tv.tv_usec); +printf ("%02d:%02d:%02d.%06u " , tm->tm_hour, tm->tm_min, tm->tm_sec, + (unsigned int )tv.tv_usec);else printf ("00:00:00.000000 " );
---
base-commit: 8d256ac07c7dada8607ae792dcd0524d91eef127
change-id: 20260308-t64-95a132121e4f
Best regards,
Signature · 1 line
Sven Eckelmann <[email protected]>