This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
nss_db: reset mapping after last get*ent
- From: DJ Delorie <dj at redhat dot com>
- To: libc-alpha at sourceware dot org
- Date: Mon, 17 Jun 2019 15:38:38 -0400
- Subject: nss_db: reset mapping after last get*ent
nss_db allows for getpwent et al to be called without a set*ent,
but it only works once. After the last get*ent a set*ent is
required to restart, because the end*ent did not properly reset
the module. Resetting it to NULL allows for a proper restart.
* nss/nss_db/db-open.c (internal_endent): Reset mapping to NULL.
diff --git a/nss/nss_db/db-open.c b/nss/nss_db/db-open.c
index 8a83d6b930..f7c53b4486 100644
--- a/nss/nss_db/db-open.c
+++ b/nss/nss_db/db-open.c
@@ -64,4 +64,5 @@ void
internal_endent (struct nss_db_map *mapping)
{
munmap (mapping->header, mapping->len);
+ mapping->header = NULL;
}