1 --- glibc-2.3.6/time/tzset.old 2004-12-07 08:50:41.000000000 +1000
2 +++ glibc-2.3.6/time/tzset.c 2008-09-10 20:08:39.000000000 +1000
4 #include <bits/libc-lock.h>
7 +#include <stdio_ext.h>
13 +#include <sys/stat.h>
16 #include <timezone/tzfile.h>
19 /* Examine the TZ environment variable. */
22 + /* Load our TZ file from our sysconfig directory */
26 + /* Stat the file to make sure it exists, and to get the size of the TZ string */
27 + if (stat64(POSIX_TZ_FILE, &st) == 0) {
28 + if (st.st_size > 256)
30 + /* After we've checked we're not going to smash our stack, allocate */
31 + tzbuf = __alloca(st.st_size + 1);
32 + /* Open the file, and read a line. That is all the file should contain */
33 + if ((ptzf = fopen(POSIX_TZ_FILE, "r")) != NULL) {
34 + /* No threads reading this stream. */
35 + __fsetlocking (ptzf, FSETLOCKING_BYCALLER);
36 + if (fgets_unlocked(tzbuf, st.st_size, ptzf) != NULL) {
44 if (tz == NULL && !explicit)
45 /* Use the site-wide default. This is a file name which means we
46 would not see changes to the file if we compare only the file
50 old_tz = tz ? __strdup (tz) : NULL;
53 /* Try to read a data file. */
54 __tzfile_read (tz, 0, NULL);
59 /* No data file found. Default to UTC if nothing specified. */
61 if (tz == NULL || *tz == '\0'