mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 14:07:45 +00:00
Kernel: Simplify sys$setgroups(0, ...)
If we're dropping all groups, just clear the extra_gids and return.
This commit is contained in:
parent
f7df521073
commit
815b73bdcc
1 changed files with 5 additions and 0 deletions
|
@ -2727,6 +2727,11 @@ int Process::sys$setgroups(ssize_t count, const gid_t* user_gids)
|
||||||
if (count && !validate_read(user_gids, count))
|
if (count && !validate_read(user_gids, count))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
|
if (!count) {
|
||||||
|
m_extra_gids.clear();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
Vector<gid_t> gids;
|
Vector<gid_t> gids;
|
||||||
gids.resize(count);
|
gids.resize(count);
|
||||||
copy_from_user(gids.data(), user_gids, sizeof(gid_t) * count);
|
copy_from_user(gids.data(), user_gids, sizeof(gid_t) * count);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue