forked from Bananymous/banan-os
Kernel: Allow getgroups with size
This can be used to query the number of groups
This commit is contained in:
parent
0066b20413
commit
3e97a82af0
|
@ -3211,8 +3211,10 @@ namespace Kernel
|
|||
BAN::ErrorOr<long> Process::sys_getgroups(gid_t groups[], size_t count)
|
||||
{
|
||||
LockGuard _(m_process_lock);
|
||||
const auto current = m_credentials.groups();
|
||||
if (count == 0)
|
||||
return current.size();
|
||||
TRY(validate_pointer_access(groups, count * sizeof(gid_t), true));
|
||||
auto current = m_credentials.groups();
|
||||
if (current.size() > count)
|
||||
return BAN::Error::from_errno(EINVAL);
|
||||
for (size_t i = 0; i < current.size(); i++)
|
||||
|
|
Loading…
Reference in New Issue