2 ms·
This is not just a thread issue! You run into a problem if you keep using a string returned by getenv after calling another environment function: including pos
by kazinator 2y ago
This is not just a thread issue!
You run into a problem if you keep using a string returned by getenv after calling another environment function: including possibly getenv itself!
However, it's easy to just strdup the result of getenv; that defends against the issue in a single-threaded program.