Use putenv+unsetenv instead of modifying environ directly.