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:
parent
8e9f51338b
commit
63b4beb8b0
1 changed files with 9 additions and 1 deletions
|
|
@ -177,7 +177,15 @@ fs_entry* fsc_read(fscrawl_t f) {
|
||||||
|
|
||||||
f->ent.base = f->path.buf;
|
f->ent.base = f->path.buf;
|
||||||
f->ent.name = &ent->d_name[0];
|
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;
|
return &f->ent;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Reference in a new issue