Fix the !HAVE_GETCWD_NULL code to behave more