Patchwork libgo patch committed: Correct syscall.Setenv if no setenv

login
register
mail settings
Submitter Ian Taylor
Date April 27, 2012, 4:28 p.m.
Message ID <mcrvckl3zr1.fsf@dhcp-172-18-216-180.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/155536/
State New
Headers show

Comments

Ian Taylor - April 27, 2012, 4:28 p.m.
This patch to libgo corrects the implementation of syscall.Setenv for
systems that do not have the setenv library call, but only have putenv.
Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu and
i386-sun-solaris2.9.  Committed to mainline and 4.7 branch.

Ian

Patch

diff -r 1ed95295e00b libgo/runtime/go-setenv.c
--- a/libgo/runtime/go-setenv.c	Wed Apr 25 21:25:31 2012 -0700
+++ b/libgo/runtime/go-setenv.c	Fri Apr 27 09:25:43 2012 -0700
@@ -50,7 +50,7 @@ 
 
 #else /* !defined(HAVE_SETENV) */
 
-  kn = malloc (k.__length + v.__length + 2);
+  kn = __go_alloc (k.__length + v.__length + 2);
   __builtin_memcpy (kn, ks, k.__length);
   kn[k.__length] = '=';
   __builtin_memcpy (kn + k.__length + 1, vs, v.__length);