Date: Tue, 14 Sep 2021 19:56:42 +0100 From: Edward Napierala <trasz@freebsd.org> To: Bryan Drewery <bdrewery@freebsd.org> Cc: "src-committers@freebsd.org" <src-committers@FreeBSD.org>, "dev-commits-src-all@freebsd.org" <dev-commits-src-all@FreeBSD.org>, "dev-commits-src-main@freebsd.org" <dev-commits-src-main@FreeBSD.org> Subject: Re: git: ddedf2a11eb2 - main - tzcode: Implement timezone change detection Message-ID: <DC7DD08C-DEE2-44DE-BD40-B4A64CA56CF7@freebsd.org> In-Reply-To: <59a39614-45d2-d9b0-a84a-476e52a81c76@FreeBSD.org> References: <202109131442.18DEgDIn043709@gitrepo.freebsd.org> <59a39614-45d2-d9b0-a84a-476e52a81c76@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
> On 14 Sep 2021, at 17:39, Bryan Drewery <bdrewery@freebsd.org> wrote:
>
> On 9/13/2021 7:42 AM, Edward Tomasz Napierala wrote:
>> +#else /* !DETECT_TZ_CHANGES */
>> +#define change_in_tz(X) 0
>
> WITHOUT_DETECT_TZ_CHANGES: change_in_tz() == 0
>
>> +#endif /* !DETECT_TZ_CHANGES */
>> +
>> static int
>> differ_by_repeat(const time_t t1, const time_t t0)
>> {
>> @@ -379,6 +418,7 @@ register const int doextend;
>> int stored;
>> int nread;
>> int res;
>> + int ret;
>> union {
>> struct tzhead tzhead;
>> char buf[2 * sizeof(struct tzhead) +
>> @@ -427,6 +467,22 @@ register const int doextend;
>> (void) strcat(fullname, name);
>> name = fullname;
>> }
>> + if (doextend == TRUE) {
>> + /*
>> + * Detect if the timezone file has changed. Check
>> + * 'doextend' to ignore TZDEFRULES; the change_in_tz()
>> + * function can only keep state for a single file.
>> + */
>> + ret = change_in_tz(name);
>> + if (ret <= 0) {
>
> WITHOUT_DETECT_TZ_CHANGES: Always returns a false-positive "done" but
> short-circuits the rest of tzload().
>
>> + /*
>> + * Returns -1 if there was an error,
>> + * and 0 if the timezone had not changed.
>> + */
>> + free(fullname);
>> + return ret;
>> + }
>> + }
Thanks! No idea how I could miss this. Does https://reviews.freebsd.org/D31961
look reasonable?
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?DC7DD08C-DEE2-44DE-BD40-B4A64CA56CF7>
