mirror of
https://github.com/RGBCube/serenity
synced 2025-07-23 10:17:41 +00:00
Kernel: File::open() should apply r/w mode from the provided options
This has been a FIXME for a long time. We now apply the provided read/write permissions to the constructed FileDescription when opening a File object via File::open().
This commit is contained in:
parent
32d0967f5f
commit
b5da0b78eb
2 changed files with 6 additions and 4 deletions
|
@ -11,8 +11,9 @@ File::~File()
|
||||||
|
|
||||||
KResultOr<NonnullRefPtr<FileDescription>> File::open(int options)
|
KResultOr<NonnullRefPtr<FileDescription>> File::open(int options)
|
||||||
{
|
{
|
||||||
UNUSED_PARAM(options);
|
auto description = FileDescription::create(*this);
|
||||||
return FileDescription::create(*this);
|
description->set_rw_mode(options);
|
||||||
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
void File::close()
|
void File::close()
|
||||||
|
|
|
@ -30,7 +30,6 @@ PTYMultiplexer::~PTYMultiplexer()
|
||||||
|
|
||||||
KResultOr<NonnullRefPtr<FileDescription>> PTYMultiplexer::open(int options)
|
KResultOr<NonnullRefPtr<FileDescription>> PTYMultiplexer::open(int options)
|
||||||
{
|
{
|
||||||
UNUSED_PARAM(options);
|
|
||||||
LOCKER(m_lock);
|
LOCKER(m_lock);
|
||||||
if (m_freelist.is_empty())
|
if (m_freelist.is_empty())
|
||||||
return KResult(-EBUSY);
|
return KResult(-EBUSY);
|
||||||
|
@ -39,7 +38,9 @@ KResultOr<NonnullRefPtr<FileDescription>> PTYMultiplexer::open(int options)
|
||||||
#ifdef PTMX_DEBUG
|
#ifdef PTMX_DEBUG
|
||||||
dbgprintf("PTYMultiplexer::open: Vending master %u\n", master->index());
|
dbgprintf("PTYMultiplexer::open: Vending master %u\n", master->index());
|
||||||
#endif
|
#endif
|
||||||
return FileDescription::create(move(master));
|
auto description = FileDescription::create(move(master));
|
||||||
|
description->set_rw_mode(options);
|
||||||
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PTYMultiplexer::notify_master_destroyed(Badge<MasterPTY>, unsigned index)
|
void PTYMultiplexer::notify_master_destroyed(Badge<MasterPTY>, unsigned index)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue