git: ddedf2a11eb2 - main - tzcode: Implement timezone change detection
Bryan Drewery
bdrewery at FreeBSD.org
Tue Sep 14 16:39:16 UTC 2021
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;
> + }
> + }
--
Regards,
Bryan Drewery
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/dev-commits-src-main/attachments/20210914/8128949f/attachment.sig>
More information about the dev-commits-src-main
mailing list