mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Env values removed by ENV.clear are not used
This commit is contained in:
parent
97e8c72e56
commit
0a986b81e1
Notes:
git
2020-04-19 00:35:33 +09:00
1 changed files with 3 additions and 4 deletions
7
hash.c
7
hash.c
|
@ -5826,10 +5826,9 @@ rb_env_clear(void)
|
||||||
|
|
||||||
keys = env_keys(TRUE);
|
keys = env_keys(TRUE);
|
||||||
for (i=0; i<RARRAY_LEN(keys); i++) {
|
for (i=0; i<RARRAY_LEN(keys); i++) {
|
||||||
VALUE val = rb_f_getenv(Qnil, RARRAY_AREF(keys, i));
|
VALUE key = RARRAY_AREF(keys, i);
|
||||||
if (!NIL_P(val)) {
|
const char *nam = RSTRING_PTR(key);
|
||||||
env_delete(RARRAY_AREF(keys, i));
|
ruby_setenv(nam, 0);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
RB_GC_GUARD(keys);
|
RB_GC_GUARD(keys);
|
||||||
return envtbl;
|
return envtbl;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue