mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-02 04:27:12 +02:00
Kernel: rmdir("/") should fail instead of asserting
We can't assume there's always a parent custody -- when we open "/" there isn't gonna be one! Fixes #1858.
This commit is contained in:
Notes:
sideshowbarker
2024-07-19 07:27:43 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/7eeea4d57f6
@@ -630,6 +630,9 @@ KResult VFS::rmdir(StringView path, Custody& base)
|
||||
if (!inode.is_directory())
|
||||
return KResult(-ENOTDIR);
|
||||
|
||||
if (!parent_custody)
|
||||
return KResult(-EBUSY);
|
||||
|
||||
auto& parent_inode = parent_custody->inode();
|
||||
|
||||
if (!parent_inode.metadata().may_write(*Process::current))
|
||||
|
||||
Reference in New Issue
Block a user