Issue #15765: Fix quirky NetBSD getcwd() behaviour.

This is done by extending a previous fix for issue #9185 that was made for
Solaris and OpenBSD to NetBSD as well.
3 files changed