Add recording and error checking of POSIX DIR pointers.