Archived
1
0
Fork 0

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.
This commit is contained in:
Henrik Hautakoski 2010-11-20 08:24:23 +01:00
parent 8e9f51338b
commit 63b4beb8b0

View file

@ -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;
}