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 <lucas.de.marchi@gmail.com>
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",