Kernel: Don't allow open() with (O_CREAT | O_DIRECTORY)

This commit is contained in:
Andreas Kling 2020-01-03 02:23:50 +01:00
parent 15f3abc849
commit 064e46e581
Notes: sideshowbarker 2024-07-19 10:24:27 +09:00

View file

@ -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)
{
if ((options & O_CREAT) && (options & O_DIRECTORY))
return KResult(-EINVAL);
RefPtr<Custody> parent_custody;
auto custody_or_error = resolve_path(path, base, &parent_custody, options);
if (options & O_CREAT) {