Force rereading TZDEFRULES after it was used to set DST rules only (bug #19253)

Message ID mvmsi44uc5w.fsf@hawking.suse.de
State New, archived
Headers

Commit Message

Andreas Schwab Nov. 17, 2015, 10:56 a.m. UTC
  If the TZDEFRULES file was used to set the DST rules when $TZ didn't
provide any we need to make sure that the next time it is used we
recompute everything as __tzfile_default changes some setting from what is
provided by TZDEFRULES.

Andreas.

	[BZ #19253]
	* time/tzfile.c (__tzfile_default): Invalidate tzfile attribute
	cache when TZDEFRULES was used.
---
 time/tzfile.c | 6 ++++++
 1 file changed, 6 insertions(+)
  

Comments

Joseph Myers Nov. 17, 2015, 11 a.m. UTC | #1
Is there some reason it's hard to add a test for this to the testsuite?
  
Andreas Schwab Nov. 17, 2015, 11:09 a.m. UTC | #2
Joseph Myers <joseph@codesourcery.com> writes:

> Is there some reason it's hard to add a test for this to the testsuite?

It depends on TZDEFRULES on the host.

Andreas.
  

Patch

diff --git a/time/tzfile.c b/time/tzfile.c
index 57abbb8..0e581f2 100644
--- a/time/tzfile.c
+++ b/time/tzfile.c
@@ -628,6 +628,12 @@  __tzfile_default (const char *std, const char *dst,
   __timezone = -types[0].offset;
 
   compute_tzname_max (stdlen + dstlen);
+
+  /* Invalidate the tzfile attribute cache to force rereading
+     TZDEFRULES the next time it is used.  */
+  tzfile_dev = 0;
+  tzfile_ino = 0;
+  tzfile_mtime = 0;
 }
 
 void