Openwrt/toolchain/musl/patches/110-read_timezone_from_fs.patch
Christian Lamparter 917e6d772c toolchain/musl: update to version 1.1.21
<https://www.openwall.com/lists/musl/2019/01/21/8>
"This release makes improvements with respect to default thread stack
size, including increasing the default from 80k to 128k, increasing
the default guard size from 4k to 8k, and allowing the default to be
increased via ELF headers so that programs that need larger stacks can
be build without source-level changes, using just LDFLAGS.
Insufficient stack size for AIO threads on kernels that don't honor
the constant MINSIGSTKSZ is also fixed.

The glob core has been rewritten to fix inability to see past
searchable-but-unreadable path components, and to avoid excessive
stack usage and unnecessary syscalls. The tsearch AVL tree
implementation has also been rewritten for better size and
performance. The math library adds more native single-instruction
implementations for arm, s390x, powerpc, and x86_64.

Various bugs are fixed, including several possible deadlocks, one of
which was a new regression in 1.1.20."

detailed release notes can be found in the WHATSNEW file:
<http://git.musl-libc.org/cgit/musl/tree/WHATSNEW#n1989>

Tested-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2019-02-05 19:35:40 +01:00

29 lines
748 B
Diff

--- a/src/time/__tz.c
+++ b/src/time/__tz.c
@@ -25,6 +25,9 @@ static int r0[5], r1[5];
static const unsigned char *zi, *trans, *index, *types, *abbrevs, *abbrevs_end;
static size_t map_size;
+static const char *tzfile;
+static size_t tzfile_size;
+
static char old_tz_buf[32];
static char *old_tz = old_tz_buf;
static size_t old_tz_size = sizeof old_tz_buf;
@@ -125,6 +128,15 @@ static void do_tzset()
"/usr/share/zoneinfo/\0/share/zoneinfo/\0/etc/zoneinfo/\0";
s = getenv("TZ");
+
+ /* if TZ is empty try to read it from /etc/TZ */
+ if (!s || !*s) {
+ if (tzfile)
+ __munmap((void*)tzfile, tzfile_size);
+
+ s = tzfile = (void *)__map_file("/etc/TZ", &tzfile_size);
+ }
+
if (!s) s = "/etc/localtime";
if (!*s) s = __utc;