diff options
Diffstat (limited to 'libgo/runtime/env_posix.c')
-rw-r--r-- | libgo/runtime/env_posix.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/libgo/runtime/env_posix.c b/libgo/runtime/env_posix.c index ee3e4514554..b93edd65a6b 100644 --- a/libgo/runtime/env_posix.c +++ b/libgo/runtime/env_posix.c @@ -11,7 +11,7 @@ extern Slice envs; -const byte* +String runtime_getenv(const char *s) { int32 i, j; @@ -19,6 +19,7 @@ runtime_getenv(const char *s) const byte *v, *bs; String* envv; int32 envc; + String ret; bs = (const byte*)s; len = runtime_findnull(bs); @@ -33,8 +34,12 @@ runtime_getenv(const char *s) goto nomatch; if(v[len] != '=') goto nomatch; - return v+len+1; + ret.str = v+len+1; + ret.len = envv[i].len-len-1; + return ret; nomatch:; } - return nil; + ret.str = nil; + ret.len = 0; + return ret; } |