mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 19:25:10 +00:00
Kernel: Add two error checks for open() to return EISDIR or ENODEV.
This commit is contained in:
parent
7d46375690
commit
e6f389a544
1 changed files with 5 additions and 0 deletions
|
@ -189,12 +189,17 @@ RetainPtr<FileDescriptor> VFS::open(const String& path, int& error, int options,
|
|||
error = -EACCES;
|
||||
return nullptr;
|
||||
}
|
||||
if (metadata.is_directory()) {
|
||||
error = -EISDIR;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
if (metadata.is_device()) {
|
||||
auto it = m_devices.find(encoded_device(metadata.major_device, metadata.minor_device));
|
||||
if (it == m_devices.end()) {
|
||||
kprintf("VFS::open: no such device %u,%u\n", metadata.major_device, metadata.minor_device);
|
||||
error = -ENODEV;
|
||||
return nullptr;
|
||||
}
|
||||
auto descriptor = (*it).value->open(error, options);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue