chiark / gitweb /
setenv emulation using putenv works properly (previously you would get wrong environm...
authorian <ian>
Wed, 19 May 1999 21:03:33 +0000 (21:03 +0000)
committerian <ian>
Wed, 19 May 1999 21:03:33 +0000 (21:03 +0000)
debian/changelog
lib.c

index 8f118328ec6113dd7df2577ee472c80acddf6c2d..e2f0b35b7f49d91e436a8fc31709c466118e5ef0 100644 (file)
@@ -1,3 +1,10 @@
+userv (0.63) unstable; urgency=low
+
+  * setenv emulation using putenv works properly (previously you would get
+    wrong environment variable settings).  (Thanks to Ben Harris.)
+
+ --
+
 userv (0.62) unstable; urgency=low
 
   * New builtin service `help' lists builtin services.
diff --git a/lib.c b/lib.c
index bd40ee08ab77376f74b1ce5715b9740a16c82e71..22c8cd1750a52af1855b242104191d6abb3028a1 100644 (file)
--- a/lib.c
+++ b/lib.c
@@ -116,14 +116,10 @@ void snytprintfcat(char *buffer, size_t size, const char *fmt, ...) {
 
 #ifndef HAVE_SETENV
 int setenv(const char *name, const char *value, int overwrite) {
-  static char *buffer= 0;
-  static int avail= 0;
-
-  int r;
+  char *buffer= 0;
   
   assert(overwrite==1);
-  r= makeroom(&buffer,&avail,strlen(name)+strlen(value)+2);
-  if (r) { errno= EINVAL; return -1; }
+  buffer= xmalloc(strlen(name)+strlen(value)+2);
 
   sprintf(buffer,"%s=%s",name,value);
   return putenv(buffer);