From a81163464cc1cbb0afeed64064b9263c83af631a Mon Sep 17 00:00:00 2001 From: m-mishima Date: Sun, 29 Jan 2017 19:01:57 +0900 Subject: [PATCH 1/2] rc: fix /etc/TZ in Japan The "JST", select UTC in localtime(); Correctly, "JST-9" select JST in localtime(); $ echo "JST" > /etc/TZ; date Sun Jan 29 10:00:49 UTC 2017 $ echo "JST-9" > /etc/TZ; date Sun Jan 29 19:01:06 JST 2017 --- release/src/router/rc/common.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/release/src/router/rc/common.c b/release/src/router/rc/common.c index a6d315c15c..b3c2af8dbb 100644 --- a/release/src/router/rc/common.c +++ b/release/src/router/rc/common.c @@ -1201,8 +1201,10 @@ void time_zone_x_mapping(void) nvram_set("time_zone_x", tmpstr); /* special mapping */ - if (nvram_match("time_zone", "JST")) + if (nvram_match("time_zone", "JST")) { nvram_set("time_zone_x", "UCT-9"); + strncpy( tmpstr, "JST-9", sizeof( tmpstr )-1 ); + } #if 0 else if (nvram_match("time_zone", "TST-10TDT")) nvram_set("time_zone_x", "UCT-10"); From 425bca735aba6b8762445528f4b26954950ae373 Mon Sep 17 00:00:00 2001 From: m-mishima Date: Thu, 2 Mar 2017 23:02:57 +0900 Subject: [PATCH 2/2] fix '\0' terminate --- release/src/router/rc/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/src/router/rc/common.c b/release/src/router/rc/common.c index b3c2af8dbb..ff90cf1dd1 100644 --- a/release/src/router/rc/common.c +++ b/release/src/router/rc/common.c @@ -1203,7 +1203,7 @@ void time_zone_x_mapping(void) /* special mapping */ if (nvram_match("time_zone", "JST")) { nvram_set("time_zone_x", "UCT-9"); - strncpy( tmpstr, "JST-9", sizeof( tmpstr )-1 ); + snprintf( tmpstr, sizeof(tmpstr), "JST-9" ); } #if 0 else if (nvram_match("time_zone", "TST-10TDT"))