aboutsummaryrefslogtreecommitdiff
path: root/time
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2017-03-07 09:37:46 +0100
committerFlorian Weimer <fweimer@redhat.com>2017-03-07 17:45:38 +0100
commit8492c4dd699e2a65a5a2e8fca3e0e530326c92b9 (patch)
tree86655668aff2779cb76e71c2abfdbe42a80d720b /time
parent1c1243b6fc33c029488add276e56570a07803bfd (diff)
downloadglibc-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')
-rw-r--r--time/tzfile.c24
-rw-r--r--time/tzset.c41
2 files changed, 4 insertions, 61 deletions
diff --git a/time/tzfile.c b/time/tzfile.c
index 4987f1a..d412469 100644
--- a/time/tzfile.c
+++ b/time/tzfile.c
@@ -48,8 +48,6 @@ struct leap
long int change; /* Seconds of correction to apply. */
};
-static void compute_tzname_max (size_t) internal_function;
-
static size_t num_transitions;
libc_freeres_ptr (static time_t *transitions);
static unsigned char *type_idxs;
@@ -494,8 +492,6 @@ __tzfile_read (const char *file, size_t extra, char **extrap)
if (__tzname[1] == NULL)
__tzname[1] = __tzname[0];
- compute_tzname_max (chars);
-
if (num_transitions == 0)
/* Use the first rule (which should also be the only one). */
rule_stdoff = rule_dstoff = types[0].offset;
@@ -626,8 +622,6 @@ __tzfile_default (const char *std, const char *dst,
/* Set the timezone. */
__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;
@@ -836,21 +830,3 @@ __tzfile_compute (time_t timer, int use_localtime,
}
}
}
-
-static void
-internal_function
-compute_tzname_max (size_t chars)
-{
- const char *p;
-
- p = zone_names;
- do
- {
- const char *start = p;
- while (*p != '\0')
- ++p;
- if ((size_t) (p - start) > __tzname_cur_max)
- __tzname_cur_max = p - start;
- }
- while (++p < &zone_names[chars]);
-}
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,