1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:47: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:
Andreas Kling 2020-04-14 12:51:02 +02:00
parent f7df521073
commit 815b73bdcc

View file

@ -2727,6 +2727,11 @@ int Process::sys$setgroups(ssize_t count, const gid_t* user_gids)
if (count && !validate_read(user_gids, count))
return -EFAULT;
if (!count) {
m_extra_gids.clear();
return 0;
}
Vector<gid_t> gids;
gids.resize(count);
copy_from_user(gids.data(), user_gids, sizeof(gid_t) * count);