Temporary fix, it only rebuilds environ on successful creation
of the new|modified variable:



acme# diff -c /sys/src/ape/lib/bsd/putenv.c putenv.c
/sys/src/ape/lib/bsd/putenv.c:2,8 - putenv.c:2,12
  #include <unistd.h>
  #include <fcntl.h>
  #include <string.h>
+ #include <stdlib.h>
  
+ extern char **environ;
+ extern void _envsetup(void);
+ 
  int
  putenv(char *s)
  {
/sys/src/ape/lib/bsd/putenv.c:26,31 - putenv.c:30,38
                if(write(f, value, n) != n)
                        return -1;
                close(f);
+               if(environ != NULL)
+                       free(environ);
+               _envsetup();
                return 0;
        } else
                return -1;



Reply via email to