mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-19 13:48:06 +00:00
aaec2ad13b
This release introduces 64-bit time_t, which is needed to avoid the year 2038 problem. Remove upstream patches. Refreshed others. Rebased features.h file based on latest musl. Signed-off-by: Rosen Penev <rosenp@gmail.com>
29 lines
748 B
Diff
29 lines
748 B
Diff
--- a/src/time/__tz.c
|
|
+++ b/src/time/__tz.c
|
|
@@ -31,6 +31,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;
|
|
@@ -132,6 +135,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;
|
|
|