mirror of
https://github.com/zeek/zeek.git
synced 2025-10-16 21:48:21 +00:00
Reduce startup time on Windows by using std::filesystem::canonical
realpath() apparently doesn't handle Windows symlinks very well. This causes plugin::Manager and ScannedFile to rescan a bunch of extra paths that they should be skipping. This commit reduces the startup time on Windows by 3-4 seconds (~8.5s to ~5s).
This commit is contained in:
parent
d6ce5894a7
commit
db161bd6df
4 changed files with 17 additions and 14 deletions
|
@ -21,14 +21,13 @@ ScannedFile::ScannedFile(int arg_include_level, std::string arg_name, bool arg_s
|
|||
canonical_path = canonical_stdin_path;
|
||||
else
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
auto res = realpath(name.data(), buf);
|
||||
std::error_code ec;
|
||||
auto canon = filesystem::canonical(name, ec);
|
||||
if ( ec )
|
||||
zeek::reporter->FatalError("failed to get canonical path of %s: %s", name.data(),
|
||||
ec.message().c_str());
|
||||
|
||||
if ( ! res )
|
||||
zeek::reporter->FatalError("failed to get realpath() of %s: %s", name.data(),
|
||||
strerror(errno));
|
||||
|
||||
canonical_path = res;
|
||||
canonical_path = canon.string();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue