Always use getwd if HAVE_GETWD is defined.
tree9a98c38144f88c66840af55be6b1482943072387
drwxr-xr-x - gcc