Setenv Is Not Thread Safe and C Doesn't Want to Fix It

# · 🔥 204 · 💬 323 · 8 months ago · www.evanjones.ca · r4um · 📷
One thread could be using this pointer when another thread changes the same environment variable using setenv() or unsetenv(). Free the environment variables: Using the pointer returned by getenv() after another thread calls setenv() can crash. Since many libraries are configured through environment variables, a program may need to change these variables to configure the libraries it uses. Add a function to copy one single environment variable to a user-specified buffer, similar to getenv s(). Add a thread-safe API to iterate over all environment variables, or to copy all variables out. Mark getenv() as deprecated, recommending the new thread-safe getenv() function instead. Mark putenv() as deprecated, recommending setenv() instead. Mark environ as deprecated, recommending environment variable functions instead. Update the implementation of environment varibles to be thread-safe. Many environment variables like OTEL SERVICE NAME and OTEL RESOURCE ATTRIBUTES. OpenSSL: many configurable variables like HTTPS PROXY, OPENSSL CONF, OPENSSL ENGINES. BoringSSL: Google's fork of OpenSSL used in Chrome and others.
Setenv Is Not Thread Safe and C Doesn't Want to Fix It



Send Feedback | WebAssembly Version (beta)