Closed
Description
I digged a bit into setenv/getenv not always working on os x and found two issues:
-
Sadly the man page says:
Successive calls to setenv() or putenv() assigning a differently sized value to the same name will result in a memory leak. The FreeBSD seman- tics for these functions (namely, that the contents of value are copied and that old values remain accessible indefinitely) make this bug unavoidable. Future versions may eliminate one or both of these semantic guarantees in order to fix the bug.
maybe this can be patched up either by an additional unsetenv call /or/
by setting a maximum buffer value when unset/size checking after having been set from rust. -
setenv/getenv are not safe for concurrent use (acording to IEEE Std 1003.1, 2004 Edition) and thus
should be wrapped by a task that processes set/get commands and is started on demand /or/ protected
by a lock in the runtime. opinions on the correct approach wanted.