[PATCH] debuginfod/debuginfod-client.c: correct string format on 32bit arches with 64bit time_t

Alexander Kanavin alex.kanavin@gmail.com
Thu Nov 25 18:50:57 GMT 2021


According to 'man 3 printf' %j appeared in glibc 2.1 and seems to be C99
feature. That's decidedly ancient.

And may I be allowed to suggest, unless elfutils is tested in upstream CI
with decade-old toolchains, you should not be considering its compatibility
with them.

Alex

On Thu, 25 Nov 2021 at 18:51, Frank Ch. Eigler <fche@redhat.com> wrote:

> Hi -
>
> > Use intmax_t to print time_t
> > [...]
> > -      if (dprintf(fd, "%ld", cache_config_default_s) < 0)
> > +      if (dprintf(fd, "%jd", (intmax_t)cache_config_default_s) < 0)
> > [...]
>
> I'm not a compatibility specialist, but note that elfutils is sometimes
> built on decade-old toolchains, where use of %lld and (long long) would
> certainly work.  We have such in the code base already, whereas this would
> be the first %j.
>
> - FChE
>
>


More information about the Elfutils-devel mailing list