summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibCore
diff options
context:
space:
mode:
authorsetepenre <usermaatre.setepenre@protonmail.com>2021-05-05 13:22:50 +0200
committerLinus Groh <mail@linusgroh.de>2021-05-05 15:12:30 +0100
commit56010379f93fe999fa25a6cbb8c3922727d85a23 (patch)
tree8dded44c94702927cf567c7fc5fdd84d36ad8ae6 /Userland/Libraries/LibCore
parentaee735889eda7243f542e42b441124dc3b4faa26 (diff)
downloadserenity-56010379f93fe999fa25a6cbb8c3922727d85a23.zip
LibCore: Call setgrent before looping on groups in get_extra_gids
Diffstat (limited to 'Userland/Libraries/LibCore')
-rw-r--r--Userland/Libraries/LibCore/Account.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/Userland/Libraries/LibCore/Account.cpp b/Userland/Libraries/LibCore/Account.cpp
index 7ed8f3b045..a0e72f2de4 100644
--- a/Userland/Libraries/LibCore/Account.cpp
+++ b/Userland/Libraries/LibCore/Account.cpp
@@ -43,6 +43,7 @@ static Vector<gid_t> get_extra_gids(const passwd& pwd)
{
StringView username { pwd.pw_name };
Vector<gid_t> extra_gids;
+ setgrent();
for (auto* group = getgrent(); group; group = getgrent()) {
if (group->gr_gid == pwd.pw_gid)
continue;