From 82050fa3e903d4c26f4277e2845a901c671d22b8 Mon Sep 17 00:00:00 2001 From: Martin Pärtel Date: Mon, 13 Apr 2020 13:00:41 +0300 Subject: Call setpwent() and setgrent(). Docs aren't super clear about whether endpwent() and endgrent() do the same. --- src/userinfo.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/userinfo.c') diff --git a/src/userinfo.c b/src/userinfo.c index a085ff0..b9a47e6 100644 --- a/src/userinfo.c +++ b/src/userinfo.c @@ -106,6 +106,8 @@ static int rebuild_uid_cache() uid_cache_size = 0; + setpwent(); + while (1) { errno = 0; pw = getpwent(); @@ -150,6 +152,8 @@ static int rebuild_gid_cache() qsort(uid_cache, uid_cache_size, sizeof(struct uid_cache_entry), uid_cache_name_sortcmp); + setgrent(); + while (1) { errno = 0; gr = getgrent(); -- cgit v1.2.3