From: Lucas De Marchi Date: Tue, 11 Jun 2024 13:02:26 +0000 (-0500) Subject: depmod: Fix warning with -D_TIME_BITS=64 X-Git-Tag: v33~51 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=22c36b7dac45e75efc373e17e08a9cd4dc7dc41c;p=thirdparty%2Fkmod.git depmod: Fix warning with -D_TIME_BITS=64 Printing time_t, suseconds_t, useconds_t in 32bits with -D_TIME_BITS=64 leads to the following warning: ../tools/depmod.c:2641:61: warning: format ‘%li’ expects argument of type ‘long int’, but argument 6 has type ‘__suseconds64_t’ {aka ‘long long int’} [-Wformat=] 2641 | snprintf(tmp, sizeof(tmp), "%s.%i.%li.%li", itr->name, getpid(), | ~~^ | | | long int | %lli 2642 | tv.tv_usec, tv.tv_sec); | ~~~~~~~~~~ Paper it over by casting the argument to 64 bits and switching to long long. Signed-off-by: Lucas De Marchi --- diff --git a/tools/depmod.c b/tools/depmod.c index 06618faf..8e9e2d11 100644 --- a/tools/depmod.c +++ b/tools/depmod.c @@ -2638,8 +2638,8 @@ static int depmod_output(struct depmod *depmod, FILE *out) int mode = 0644; int fd; - snprintf(tmp, sizeof(tmp), "%s.%i.%li.%li", itr->name, getpid(), - tv.tv_usec, tv.tv_sec); + snprintf(tmp, sizeof(tmp), "%s.%i.%lli.%lli", itr->name, getpid(), + (long long)tv.tv_usec, (long long)tv.tv_sec); fd = openat(dfd, tmp, flags, mode); if (fd < 0) { ERR("openat(%s, %s, %o, %o): %m\n",