core: Support non-thread-safe getenv.