From fdbd7bd2c9ccd988ef014fb60fd553d5594455e6 Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Sun, 29 Jun 2014 01:06:07 +0900 Subject: [PATCH] [bugfix] glibc's getenv function does not igrore trailing '=' --- src/system.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/system.c b/src/system.c index efd53f48..73b27262 100644 --- a/src/system.c +++ b/src/system.c @@ -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);