diff options
author | Florian Weimer <fweimer@redhat.com> | 2017-03-07 09:37:46 +0100 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2017-03-07 17:45:38 +0100 |
commit | 8492c4dd699e2a65a5a2e8fca3e0e530326c92b9 (patch) | |
tree | 86655668aff2779cb76e71c2abfdbe42a80d720b /time/tzset.c | |
parent | 1c1243b6fc33c029488add276e56570a07803bfd (diff) | |
download | glibc-8492c4dd699e2a65a5a2e8fca3e0e530326c92b9.zip glibc-8492c4dd699e2a65a5a2e8fca3e0e530326c92b9.tar.gz glibc-8492c4dd699e2a65a5a2e8fca3e0e530326c92b9.tar.bz2 |
timezone: Remove TZNAME_MAX limit from sysconf [BZ #15576]
glibc does not impose a limit, and POSIX does not allow a
sysconf limit which changes during the lifetime of a process.
Diffstat (limited to 'time/tzset.c')
-rw-r--r-- | time/tzset.c | 41 |
1 files changed, 4 insertions, 37 deletions
diff --git a/time/tzset.c b/time/tzset.c index 262bbe5..f0e5c95 100644 --- a/time/tzset.c +++ b/time/tzset.c @@ -68,8 +68,7 @@ static tz_rule tz_rules[2]; static void compute_change (tz_rule *rule, int year) __THROW internal_function; -static void tzset_internal (int always, int explicit) - __THROW internal_function; +static void tzset_internal (int always); /* List of buffers containing time zone strings. */ struct tzstring_l @@ -126,24 +125,7 @@ __tzstring (const char *s) { return __tzstring_len (s, strlen (s)); } - -/* Maximum length of a timezone name. tzset_internal keeps this up to date - (never decreasing it) when ! __use_tzfile. - tzfile.c keeps it up to date when __use_tzfile. */ -size_t __tzname_cur_max; - -long int -__tzname_max (void) -{ - __libc_lock_lock (tzset_lock); - - tzset_internal (0, 0); - - __libc_lock_unlock (tzset_lock); - return __tzname_cur_max; -} - static char *old_tz; static void @@ -154,14 +136,6 @@ update_vars (void) __timezone = -tz_rules[0].offset; __tzname[0] = (char *) tz_rules[0].name; __tzname[1] = (char *) tz_rules[1].name; - - /* Keep __tzname_cur_max up to date. */ - size_t len0 = strlen (__tzname[0]); - size_t len1 = strlen (__tzname[1]); - if (len0 > __tzname_cur_max) - __tzname_cur_max = len0; - if (len1 > __tzname_cur_max) - __tzname_cur_max = len1; } @@ -390,8 +364,7 @@ __tzset_parse_tz (const char *tz) /* Interpret the TZ envariable. */ static void -internal_function -tzset_internal (int always, int explicit) +tzset_internal (int always) { static int is_initialized; const char *tz; @@ -402,12 +375,6 @@ tzset_internal (int always, int explicit) /* Examine the TZ environment variable. */ tz = getenv ("TZ"); - if (tz == NULL && !explicit) - /* Use the site-wide default. This is a file name which means we - would not see changes to the file if we compare only the file - name for change. We want to notice file changes if tzset() has - been called explicitly. Leave TZ as NULL in this case. */ - tz = TZDEFAULT; if (tz && *tz == '\0') /* User specified the empty string; use UTC explicitly. */ tz = "Universal"; @@ -583,7 +550,7 @@ __tzset (void) { __libc_lock_lock (tzset_lock); - tzset_internal (1, 1); + tzset_internal (1); if (!__use_tzfile) { @@ -615,7 +582,7 @@ __tz_convert (const time_t *timer, int use_localtime, struct tm *tp) /* Update internal database according to current TZ setting. POSIX.1 8.3.7.2 says that localtime_r is not required to set tzname. This is a good idea since this allows at least a bit more parallelism. */ - tzset_internal (tp == &_tmbuf && use_localtime, 1); + tzset_internal (tp == &_tmbuf && use_localtime); if (__use_tzfile) __tzfile_compute (*timer, use_localtime, &leap_correction, |