From 63b4beb8b0799718fa9c270616985fa84f1b8547 Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Sat, 20 Nov 2010 08:24:23 +0100 Subject: [PATCH] fscrawl.c: don't ignore DT_UNKNOWN. issue with struct dirent->d_type set to DT_UNKNOWN on some filesystems. this is solved by doing a call to 'is_dir' in those cases. --- src/fscrawl.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/fscrawl.c b/src/fscrawl.c index b7b249b..4c1346c 100644 --- a/src/fscrawl.c +++ b/src/fscrawl.c @@ -177,7 +177,15 @@ fs_entry* fsc_read(fscrawl_t f) { f->ent.base = f->path.buf; f->ent.name = &ent->d_name[0]; - f->ent.dir = ent->d_type == 4; + + if (ent->d_type == DT_UNKNOWN) { + size_t tmp = strlen(f->ent.name); + strbuf_append(&f->path, f->ent.name, tmp); + f->ent.dir = is_dir(f->path.buf); + strbuf_reduce(&f->path, tmp); + } else { + f->ent.dir = ent->d_type == DT_DIR; + } return &f->ent; }