static bool setup_dir (FTS *fts) { return true; }
static void free_dir (FTS *fts) {}
#else
-# include "fcntl--.h"
# include "fts-cycle.c"
#endif
p->fts_level = FTS_ROOTLEVEL;
p->fts_parent = parent;
p->fts_accpath = p->fts_name;
- if (defer_stat) {
+ /* Even when defer_stat is true, be sure to stat the first
+ command line argument, since fts_read (at least with
+ FTS_XDEV) requires that. */
+ if (defer_stat && root != NULL) {
p->fts_info = FTS_NSOK;
fts_set_stat_required(p, true);
} else {
/* Read the directory, attaching each entry to the `link' pointer. */
doadjust = false;
for (head = tail = NULL, nitems = 0; dirp && (dp = readdir(dirp));) {
+ bool is_dir;
+
if (!ISSET(FTS_SEEDOT) && ISDOT(dp->d_name))
continue;
} else
p->fts_accpath = p->fts_name;
- bool is_dir;
if (sp->fts_compar == NULL || ISSET(FTS_DEFER_STAT)) {
/* Record what fts_read will have to do with this
entry. In many cases, it will simply fts_stat it,