diff --git a/source/common/filesystem/posix/filesystem_impl.cc b/source/common/filesystem/posix/filesystem_impl.cc index d9714ce37b9b..b10aa7bdee18 100644 --- a/source/common/filesystem/posix/filesystem_impl.cc +++ b/source/common/filesystem/posix/filesystem_impl.cc @@ -339,9 +339,13 @@ bool InstanceImplPosix::illegalPath(const std::string& path) { // platform in the future, growing these or relaxing some constraints (e.g. // there are valid reasons to go via /proc for file paths). // TODO(htuch): Optimize this as a hash lookup if we grow any further. - if (absl::StartsWith(canonical_path.return_value_, "/dev") || - absl::StartsWith(canonical_path.return_value_, "/sys") || - absl::StartsWith(canonical_path.return_value_, "/proc")) { + // It will allow the canonical path such as /sysroot/ which is not the + // default reserved directories (/dev, /sys, /proc) + if (absl::StartsWith(canonical_path.return_value_, "/dev/") || + absl::StartsWith(canonical_path.return_value_, "/sys/") || + absl::StartsWith(canonical_path.return_value_, "/proc/") || + canonical_path.return_value_ == "/dev" || canonical_path.return_value_ == "/sys" || + canonical_path.return_value_ == "/proc") { return true; } return false; diff --git a/tools/spelling/spelling_dictionary.txt b/tools/spelling/spelling_dictionary.txt index 4c8efee1ae6c..670192ef17d7 100644 --- a/tools/spelling/spelling_dictionary.txt +++ b/tools/spelling/spelling_dictionary.txt @@ -1349,6 +1349,7 @@ sys syscall syscalls sysctl +sysroot sz tchar tchars