mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-26 14:28:49 +00:00
Kernel+Tests: Make sys$rmdir() fail with EINVAL if basename is "."
Dr. POSIX says that we should reject attempts to rmdir() the file named "." so this patch does exactly that. We also add a test. This solves a FIXME from January 2019. :^)
This commit is contained in:
parent
42b011b571
commit
8d781d0216
Notes:
sideshowbarker
2024-07-17 05:00:08 +09:00
Author: https://github.com/awesomekling
Commit: 8d781d0216
Pull-request: https://github.com/SerenityOS/serenity/pull/16594
Reviewed-by: https://github.com/FalseHonesty
Reviewed-by: https://github.com/krkk
Reviewed-by: https://github.com/supercomputer7 ✅
Reviewed-by: https://github.com/xZise
2 changed files with 26 additions and 1 deletions
|
@ -841,7 +841,12 @@ ErrorOr<void> VirtualFileSystem::rmdir(Credentials const& credentials, StringVie
|
|||
auto custody = TRY(resolve_path(credentials, path, base, &parent_custody));
|
||||
auto& inode = custody->inode();
|
||||
|
||||
// FIXME: We should return EINVAL if the last component of the path is "."
|
||||
auto last_component = KLexicalPath::basename(path);
|
||||
|
||||
// [EINVAL] The path argument contains a last component that is dot.
|
||||
if (last_component == "."sv)
|
||||
return EINVAL;
|
||||
|
||||
// FIXME: We should return ENOTEMPTY if the last component of the path is ".."
|
||||
|
||||
if (!inode.is_directory())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue