summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2021-09-13 11:59:04 -0700
committerJeremy Evans <code@jeremyevans.net>2021-09-14 05:55:14 -0900
commit57d315c937e79199af2b77f21f5eecaca85ffac8 (patch)
tree2cb1f5530720afa596debc33a3d4c4ac10ca422c /hash.c
parent616d6717589abb30a5c67c79cbf874693c3dadbd (diff)
Handle overwriting Object::ENV in spawn
Instead of looking for Object::ENV (which can be overwritten), directly look for the envtbl variable. As that is static in hash.c, and the lookup code is in process.c, add a couple non-static functions that will return envtbl (or envtbl#to_hash). Fixes [Bug #18164]
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4834
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/hash.c b/hash.c
index f75e39430c..fd21a99be0 100644
--- a/hash.c
+++ b/hash.c
@@ -6182,6 +6182,18 @@ env_to_hash(void)
return hash;
}
+VALUE
+rb_envtbl(void)
+{
+ return envtbl;
+}
+
+VALUE
+rb_env_to_hash(void)
+{
+ return env_to_hash();
+}
+
/*
* call-seq:
* ENV.to_hash -> hash of name/value pairs