summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-08-27 13:59:09 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-08-27 13:59:09 +0000
commit1bbf778962743171693a9a279914bf9dae431405 (patch)
tree776e7355f053a96563df3c536b8dd99582b53bcd /hash.c
parent4941bba3c8b5eda08691ebcb14930659897b997c (diff)
merge revision(s) 63994: [Backport #14920]
reduce tzset * time.c (rb_localtime_r): call tzset() only after TZ environment variable is changed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@64560 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/hash.c b/hash.c
index c372686f12..5f237c0c9a 100644
--- a/hash.c
+++ b/hash.c
@@ -3136,6 +3136,9 @@ env_str_new2(const char *ptr)
static int env_path_tainted(const char *);
+static const char TZ_ENV[] = "TZ";
+extern int ruby_tz_update;
+
static rb_encoding *
env_encoding_for(const char *name, const char *ptr)
{
@@ -3217,6 +3220,9 @@ env_delete(VALUE obj, VALUE name)
RB_GC_GUARD(name);
path_tainted = 0;
}
+ else if (ENVMATCH(nam, TZ_ENV)) {
+ ruby_tz_update = 0;
+ }
return value;
}
return Qnil;
@@ -3576,6 +3582,9 @@ env_aset(VALUE obj, VALUE nm, VALUE val)
path_tainted_p(value);
}
}
+ else if (ENVMATCH(name, TZ_ENV)) {
+ ruby_tz_update = 0;
+ }
return val;
}