I have created a simple C++ wrapper around these environment variable functions for POSIX aiming for a thread-safety in the first place: safe-env.