[bugfix] glibc's getenv function does not igrore trailing '='

This commit is contained in:
Yuichi Nishiwaki 2014-06-29 01:06:07 +09:00
parent 89506d0ced
commit fdbd7bd2c9
1 changed files with 4 additions and 4 deletions

View File

@ -104,17 +104,17 @@ pic_system_getenvs(pic_state *pic)
}
for (envp = pic->envp; *envp; ++envp) {
pic_value key, val;
pic_str *key, *val;
int i;
for (i = 0; (*envp)[i] != '='; ++i)
;
key = pic_obj_value(pic_str_new(pic, *envp, i));
val = pic_obj_value(pic_str_new_cstr(pic, getenv(*envp)));
key = pic_str_new(pic, *envp, i);
val = pic_str_new_cstr(pic, getenv(pic_str_cstr(key)));
/* push */
data = pic_acons(pic, key, val, data);
data = pic_acons(pic, pic_obj_value(key), pic_obj_value(val), data);
pic_gc_arena_restore(pic, ai);
pic_gc_protect(pic, data);