mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
lsp: Limit resolvesToRegularFile()'s recursion depth to 10.
This commit is contained in:
parent
3fc7debbef
commit
c8074d2c6e
@ -58,14 +58,15 @@ namespace fs = boost::filesystem;
|
||||
namespace
|
||||
{
|
||||
|
||||
bool resolvesToRegularFile(boost::filesystem::path _path)
|
||||
bool resolvesToRegularFile(boost::filesystem::path _path, int maxRecursionDepth = 10)
|
||||
{
|
||||
fs::file_status fileStatus = fs::status(_path);
|
||||
|
||||
while (fileStatus.type() == fs::file_type::symlink_file)
|
||||
while (fileStatus.type() == fs::file_type::symlink_file && maxRecursionDepth > 0)
|
||||
{
|
||||
_path = boost::filesystem::read_symlink(_path);
|
||||
fileStatus = fs::status(_path);
|
||||
maxRecursionDepth--;
|
||||
}
|
||||
|
||||
return fileStatus.type() == fs::file_type::regular_file;
|
||||
|
Loading…
Reference in New Issue
Block a user