enumerator: Fall back to lstat() if stat() fails when enumerating dirs/files

This happens e.g. if the path is for an invalid symlink.
This commit is contained in:
Tobias Brunner
2020-02-13 11:54:19 +01:00
parent fdce492ed0
commit 19b2f870e2
2 changed files with 8 additions and 2 deletions
+3 -2
View File
@@ -129,9 +129,10 @@ METHOD(enumerator_t, enumerate_dir_enum, bool,
{
*absolute = this->full;
}
if (st)
if (st && stat(this->full, st))
{
if (stat(this->full, st))
/* try lstat() e.g. if a symlink is not valid anymore */
if ((errno != ENOENT && errno != ENOTDIR) || lstat(this->full, st))
{
DBG1(DBG_LIB, "stat() on '%s' failed: %s", this->full,
strerror(errno));