mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:58:11 +00:00
Kernel: Allow fchmod() and fchown() on pre-bind() local sockets
In order to ensure a specific owner and mode when the local socket filesystem endpoint is instantiated, we need to be able to call fchmod() and fchown() on a socket fd between socket() and bind(). This is because until we call bind(), there is no filesystem inode for the socket yet.
This commit is contained in:
parent
4abbedb6e4
commit
d84299c7be
8 changed files with 57 additions and 13 deletions
|
@ -64,13 +64,6 @@ KResult FileDescription::fstat(stat& buffer)
|
|||
return metadata().stat(buffer);
|
||||
}
|
||||
|
||||
KResult FileDescription::fchmod(mode_t mode)
|
||||
{
|
||||
if (!m_inode)
|
||||
return KResult(-EBADF);
|
||||
return VFS::the().chmod(*m_inode, mode);
|
||||
}
|
||||
|
||||
off_t FileDescription::seek(off_t offset, int whence)
|
||||
{
|
||||
if (!m_file->is_seekable())
|
||||
|
@ -282,9 +275,12 @@ void FileDescription::set_file_flags(u32 flags)
|
|||
m_file_flags = flags;
|
||||
}
|
||||
|
||||
KResult FileDescription::chmod(mode_t mode)
|
||||
{
|
||||
return m_file->chmod(mode);
|
||||
}
|
||||
|
||||
KResult FileDescription::chown(uid_t uid, gid_t gid)
|
||||
{
|
||||
if (!m_inode)
|
||||
return KResult(-EINVAL);
|
||||
return VFS::the().chown(*m_inode, uid, gid);
|
||||
return m_file->chown(uid, gid);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue