+ if(cur->fts_pathlen == cur->fts_namelen &&
+ fnflag == FTW_DNR) {
+ /* If cwd_fd is our last FD, fts_read will give us FTS_DNR
+ * and fts_path == fts_name == "."
+ * This check results in the correct errno being returned.
+ */
+ errno = EMFILE;
+ }