mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:57:45 +00:00
LibCore: Prevent infinite recursion in Directory::ensure_directory()
If a relative path was passed in, then repeatedly asking for its parent will never reach `/`. The top-level path in that case is `.`.
This commit is contained in:
parent
3426592ee7
commit
6967d37678
1 changed files with 1 additions and 1 deletions
|
@ -61,7 +61,7 @@ ErrorOr<Directory> Directory::create(LexicalPath path, CreateDirectories create_
|
||||||
|
|
||||||
ErrorOr<void> Directory::ensure_directory(LexicalPath const& path)
|
ErrorOr<void> Directory::ensure_directory(LexicalPath const& path)
|
||||||
{
|
{
|
||||||
if (path.basename() == "/")
|
if (path.basename() == "/" || path.basename() == ".")
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
TRY(ensure_directory(path.parent()));
|
TRY(ensure_directory(path.parent()));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue