diff --git a/lib/fts.c b/lib/fts.c index 40a837e..1394693 100644 --- a/lib/fts.c +++ b/lib/fts.c @@ -1269,6 +1269,21 @@ fts_build (register FTS *sp, int type) if (cur->fts_info == FTS_NSOK) cur->fts_info = fts_stat(sp, cur, false); + else /* TODO: check for an option here */ { + FTSENT tmp = *cur; + fts_stat (sp, &tmp, false); + if (cur->fts_statp->st_ino == tmp.fts_statp->st_ino + && cur->fts_statp->st_dev != tmp.fts_statp->st_dev) { + LEAVE_DIR (sp, cur, "4"); + cur->fts_statp->st_dev = tmp.fts_statp->st_dev; + if (! enter_dir (sp, cur)) + { + __set_errno (ENOMEM); + return NULL; + } + } + } + /* * Nlinks is the number of possible entries of type directory in the * directory if we're cheating on stat calls, 0 if we're not doing