Skip to content

Commit 0bbc65b

Browse files
committed
nfctool: Fix builds on 32-bit ARM with __USE_TIME64_REDIRECTS
tv_sec and tv_usec might be long or long long, depending on __USE_TIME64_REDIRECTS. 32-bit ARM Debian builds apparently defined it as long long, so they failed: tools/nfctool/llcp-decode.c: In function 'llcp_print_pdu': tools/nfctool/llcp-decode.c:553:41: error: format '%ld' expects argument of type 'long int', but argument 4 has type '__time64_t' {aka 'long long int'} [-Werror=format=] 553 | sprintf(time_str, "%c%ld.%06lds", prefix, msg_timestamp.tv_sec, | ~~^ ~~~~~~~~~~~~~~~~~~~~ | | | | long int __time64_t {aka long long int} | %lld tools/nfctool/llcp-decode.c:553:47: error: format '%ld' expects argument of type 'long int', but argument 5 has type '__suseconds64_t' {aka 'long long int'} [-Werror=format=] 553 | sprintf(time_str, "%c%ld.%06lds", prefix, msg_timestamp.tv_sec, | ~~~~^ | | | long int | %06lld 554 | msg_timestamp.tv_usec); | ~~~~~~~~~~~~~~~~~~~~~ | | | __suseconds64_t {aka long long int} Let's just cast this to long long, so same code will work fine for both platforms. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
1 parent 661a9fb commit 0bbc65b

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

tools/nfctool/llcp-decode.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -550,8 +550,8 @@ int llcp_print_pdu(guint8 *data, guint32 data_len, struct timeval *timestamp)
550550
prefix = '+';
551551
}
552552

553-
sprintf(time_str, "%c%ld.%06lds", prefix, msg_timestamp.tv_sec,
554-
msg_timestamp.tv_usec);
553+
sprintf(time_str, "%c%lld.%06llds", prefix, (long long int)msg_timestamp.tv_sec,
554+
(long long int)msg_timestamp.tv_usec);
555555
}
556556

557557
llcp_printf_header(direction_str, direction_color,

0 commit comments

Comments
 (0)