Eli Zaretskii wrote:
> We sanitize TZ when we call init_timefns at startup.  So I think we
> are okay with this?

Yes, with a call to tzsanitize() at startup, you don't need the
localtime module from gnulib [1], and you also don't need the mktime
module from gnulib if you don't care about the other bugs that it fixes [2].

> Btw, I see a call to tzsanitize in lib/mktime.c, but I don't see where
> it is called from mktime.  What did I miss?

Indeed, reading gnulib code that is shared with glibc is hard, because
most of the code is written with glibc in mind, and the macros for use
outside of glibc are added on top.

mktime-internal.h does '# define __mktime64 mktime'.
mktime.c line 518 therefore defines mktime.
1. It invokes __tzset_unlocked, which macroexpands to my_tzset.
   my_tzset, defined in mktime.c line 75, invokes tzsanitize().
2. Then it invokes __mktime_internal, at mktime.c line 310.

Bruno

[1] https://www.gnu.org/software/gnulib/manual/html_node/localtime.html
[2] https://www.gnu.org/software/gnulib/manual/html_node/mktime.html




Reply via email to