mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:57:35 +00:00
Kernel: Pass a FileDescription to File::chmod() and File::chown()
We're going to make use of it in the next commit. But the idea is we want to know how this File (more specifically, InodeFile) was opened in order to decide how chown()/chmod() should behave, in particular whether it should be allowed or not. Note that many other File operations, such as read(), write(), and ioctl(), already require the caller to pass a FileDescription.
This commit is contained in:
parent
67cbc015d5
commit
a9946a99f2
6 changed files with 14 additions and 12 deletions
|
@ -375,7 +375,7 @@ KResult LocalSocket::getsockopt(FileDescription& description, int level, int opt
|
|||
}
|
||||
}
|
||||
|
||||
KResult LocalSocket::chmod(mode_t mode)
|
||||
KResult LocalSocket::chmod(FileDescription&, mode_t mode)
|
||||
{
|
||||
if (m_file)
|
||||
return m_file->chmod(mode);
|
||||
|
@ -384,7 +384,7 @@ KResult LocalSocket::chmod(mode_t mode)
|
|||
return KSuccess;
|
||||
}
|
||||
|
||||
KResult LocalSocket::chown(uid_t uid, gid_t gid)
|
||||
KResult LocalSocket::chown(FileDescription&, uid_t uid, gid_t gid)
|
||||
{
|
||||
if (m_file)
|
||||
return m_file->chown(uid, gid);
|
||||
|
|
|
@ -60,8 +60,8 @@ public:
|
|||
virtual ssize_t sendto(FileDescription&, const void*, size_t, int, const sockaddr*, socklen_t) override;
|
||||
virtual ssize_t recvfrom(FileDescription&, void*, size_t, int flags, sockaddr*, socklen_t*) override;
|
||||
virtual KResult getsockopt(FileDescription&, int level, int option, void*, socklen_t*) override;
|
||||
virtual KResult chown(uid_t, gid_t) override;
|
||||
virtual KResult chmod(mode_t) override;
|
||||
virtual KResult chown(FileDescription&, uid_t, gid_t) override;
|
||||
virtual KResult chmod(FileDescription&, mode_t) override;
|
||||
|
||||
private:
|
||||
explicit LocalSocket(int type);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue