aboutsummaryrefslogtreecommitdiff
path: root/libgo/runtime/go-setenv.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2013-01-29 20:52:43 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2013-01-29 20:52:43 +0000
commitd6f2922e91928b5191a5c5f1b3a6b320712b5ce3 (patch)
tree4f2fad1f4b778519bdd5941185c7e1d032af055b /libgo/runtime/go-setenv.c
parent91bfca59095b1cca9d4364996866848eaaf76c26 (diff)
downloadgcc-d6f2922e91928b5191a5c5f1b3a6b320712b5ce3.zip
gcc-d6f2922e91928b5191a5c5f1b3a6b320712b5ce3.tar.gz
gcc-d6f2922e91928b5191a5c5f1b3a6b320712b5ce3.tar.bz2
libgo: Update Go library to master revision 15489/921e53d4863c.
From-SVN: r195560
Diffstat (limited to 'libgo/runtime/go-setenv.c')
-rw-r--r--libgo/runtime/go-setenv.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/libgo/runtime/go-setenv.c b/libgo/runtime/go-setenv.c
index 53ef2d3..6c7378c 100644
--- a/libgo/runtime/go-setenv.c
+++ b/libgo/runtime/go-setenv.c
@@ -25,20 +25,25 @@ setenv_c (String k, String v)
unsigned char *vn;
ks = k.str;
+ if (ks == NULL)
+ ks = (const byte *) "";
kn = NULL;
+
vs = v.str;
+ if (vs == NULL)
+ vs = (const byte *) "";
vn = NULL;
#ifdef HAVE_SETENV
- if (ks[k.len] != 0)
+ if (ks != NULL && ks[k.len] != 0)
{
kn = __go_alloc (k.len + 1);
__builtin_memcpy (kn, ks, k.len);
ks = kn;
}
- if (vs[v.len] != 0)
+ if (vs != NULL && vs[v.len] != 0)
{
vn = __go_alloc (v.len + 1);
__builtin_memcpy (vn, vs, v.len);