Fixed crash where too many symlinks are hit, fixes #853

This commit is contained in:
emeric
2026-06-11 21:25:56 +02:00
parent 986a6e2580
commit 6825f6130d
@@ -67,25 +67,35 @@ namespace lms::scanner
{
continueExploring = cb(ec, path, nullptr);
}
else if (entry.is_regular_file())
else
{
if (shouldIgnore(path, IgnoreRules::IsDirectory{ false }))
const bool isFile{ entry.is_regular_file(ec) };
const bool isDir{ !ec && !isFile && entry.is_directory(ec) };
if (ec)
{
LMS_LOG(DBUPDATER, DEBUG, "Ignoring file " << path << " (matched .lmsignore rule)");
itPath.increment(ec);
continue;
continueExploring = cb(ec, path, nullptr);
}
continueExploring = cb(ec, path, &entry);
}
else if (entry.is_directory())
{
if (shouldIgnore(path, IgnoreRules::IsDirectory{ true }))
else if (isFile)
{
LMS_LOG(DBUPDATER, DEBUG, "Ignoring directory " << path << " (matched .lmsignore rule)");
itPath.increment(ec);
continue;
if (shouldIgnore(path, IgnoreRules::IsDirectory{ false }))
{
LMS_LOG(DBUPDATER, DEBUG, "Ignoring file " << path << " (matched .lmsignore rule)");
itPath.increment(ec);
continue;
}
continueExploring = cb(ec, path, &entry);
}
else if (isDir)
{
if (shouldIgnore(path, IgnoreRules::IsDirectory{ true }))
{
LMS_LOG(DBUPDATER, DEBUG, "Ignoring directory " << path << " (matched .lmsignore rule)");
itPath.increment(ec);
continue;
}
continueExploring = exploreFilesRecursive(path, cb, shouldIgnore);
}
continueExploring = exploreFilesRecursive(path, cb, shouldIgnore);
}
if (!continueExploring)