Reverted indexing from modern openat()/fdopendir()/fstatat() calls to more traditional chdir()/opendir()/lstat(). Performance reduction is minimal, but this implementation is more portable to other platforms