mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:28:11 +00:00
Kernel: Don't allow open() with (O_CREAT | O_DIRECTORY)
This commit is contained in:
parent
15f3abc849
commit
064e46e581
1 changed files with 3 additions and 0 deletions
|
@ -185,6 +185,9 @@ KResultOr<InodeMetadata> VFS::lookup_metadata(StringView path, Custody& base, in
|
||||||
|
|
||||||
KResultOr<NonnullRefPtr<FileDescription>> VFS::open(StringView path, int options, mode_t mode, Custody& base)
|
KResultOr<NonnullRefPtr<FileDescription>> VFS::open(StringView path, int options, mode_t mode, Custody& base)
|
||||||
{
|
{
|
||||||
|
if ((options & O_CREAT) && (options & O_DIRECTORY))
|
||||||
|
return KResult(-EINVAL);
|
||||||
|
|
||||||
RefPtr<Custody> parent_custody;
|
RefPtr<Custody> parent_custody;
|
||||||
auto custody_or_error = resolve_path(path, base, &parent_custody, options);
|
auto custody_or_error = resolve_path(path, base, &parent_custody, options);
|
||||||
if (options & O_CREAT) {
|
if (options & O_CREAT) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue