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,7 +67,16 @@ namespace lms::scanner
{ {
continueExploring = cb(ec, path, nullptr); continueExploring = cb(ec, path, nullptr);
} }
else if (entry.is_regular_file()) else
{
const bool isFile{ entry.is_regular_file(ec) };
const bool isDir{ !ec && !isFile && entry.is_directory(ec) };
if (ec)
{
continueExploring = cb(ec, path, nullptr);
}
else if (isFile)
{ {
if (shouldIgnore(path, IgnoreRules::IsDirectory{ false })) if (shouldIgnore(path, IgnoreRules::IsDirectory{ false }))
{ {
@@ -77,7 +86,7 @@ namespace lms::scanner
} }
continueExploring = cb(ec, path, &entry); continueExploring = cb(ec, path, &entry);
} }
else if (entry.is_directory()) else if (isDir)
{ {
if (shouldIgnore(path, IgnoreRules::IsDirectory{ true })) if (shouldIgnore(path, IgnoreRules::IsDirectory{ true }))
{ {
@@ -87,6 +96,7 @@ namespace lms::scanner
} }
continueExploring = exploreFilesRecursive(path, cb, shouldIgnore); continueExploring = exploreFilesRecursive(path, cb, shouldIgnore);
} }
}
if (!continueExploring) if (!continueExploring)
return false; return false;