+2004-08-11 Ulrich Drepper <drepper@redhat.com>
+
+ * time/tzset.c (tzset_internal): Add new parameter which is
+ nonzero if called through tzset. Use TZDEFAULT name including
+ name comparison if the new parameter is zero. This means implicit
+ tzset calls will not cause files to be opened and read by tzfile.c
+ all the time.
+
+2004-08-11 Jakub Jelinek <jakub@redhat.com>
+
+ * time/tzfile.c (__tzfile_read): Free transitions only if it will
+ not be reused.
+
2004-08-11 Jakub Jelinek <jakub@redhat.com>
* sysdeps/ieee754/dbl-64/mpa.c: Include <sys/param.h>.
__use_tzfile = 0;
- if (transitions != NULL)
- free ((void *) transitions);
- transitions = NULL;
-
if (file == NULL)
/* No user specification; use the site-wide default. */
file = TZDEFAULT;
else if (*file == '\0')
/* User specified the empty string; use UTC with no leap seconds. */
- return;
+ goto ret_free_transitions;
else
{
/* We must not allow to read an arbitrary file in a setuid
|| strstr (file, "../") != NULL))
/* This test is certainly a bit too restrictive but it should
catch all critical cases. */
- return;
+ goto ret_free_transitions;
}
if (*file != '/')
disabled. */
f = fopen (file, "rc");
if (f == NULL)
- return;
+ goto ret_free_transitions;
/* Get information about the file. */
struct stat64 st;
if (fstat64 (fileno (f), &st) != 0)
{
fclose (f);
- return;
+ goto ret_free_transitions;
}
if (was_using_tzfile && tzfile_ino == st.st_ino && tzfile_dev == st.st_dev)
{
return;
}
+ free ((void *) transitions);
+ transitions = NULL;
+
/* Remember the inode and device number. */
tzfile_dev = st.st_dev;
tzfile_ino = st.st_ino;
lose:
fclose (f);
+ ret_free_transitions:
+ free ((void *) transitions);
+ transitions = NULL;
}
\f
/* The user specified a hand-made timezone, but not its DST rules.