2 ms·
The spec says it's not supposed to be thread safe. There's also no real backwards compatible way of fixing setenv(). getenv() returns a pointer that can be rea
by jeroenhd 2y ago
The spec says it's not supposed to be thread safe.
There's also no real backwards compatible way of fixing setenv(). getenv() returns a pointer that can be read at any time, and then there's the *environment parameter that can also be used to read env variables.
IMO the entire API should be deprecated for a thread safe one, but until someone comes with a standard setenv() alternative that's implemented by the libc runtimes, we'll be stuck with the shitty POSIX API, and every year we will read blog posts about get/setenv() crashing processes.