Fix __getcwd rewinddir namespace (bug 17584).