Note: at least musl-libc and newer glibc stick to standards and consider setenv(..., NULL, ...) UB as per http://pubs.opengroup.org/onlinepubs/9699919799/functions/setenv.html We choose this fix because it mimics old behaviour of glibc, but the real fix would be to not call at all setenv with NULL second parameter. Musl relevant mail thread: http://www.openwall.com/lists/musl/2015/04/23/1