Blame SOURCES/autofs-5.1.5-use-local-getmntent_r-in-get_mnt_list.patch

135b98
autofs-5.1.5 - use local getmntent_r() in get_mnt_list()
135b98
135b98
From: Ian Kent <raven@themaw.net>
135b98
135b98
Change get_mnt_list() to use the local getmntent_r() instead of
135b98
the glibc version so that if glibc is changed to support the
135b98
autofs "ignore" hint automount(8) won't be affected.
135b98
135b98
Signed-off-by: Ian Kent <raven@themaw.net>
135b98
---
135b98
 CHANGELOG    |    1 +
135b98
 lib/mounts.c |    8 ++++----
135b98
 2 files changed, 5 insertions(+), 4 deletions(-)
135b98
135b98
--- autofs-5.1.4.orig/CHANGELOG
135b98
+++ autofs-5.1.4/CHANGELOG
135b98
@@ -73,6 +73,7 @@ xx/xx/2018 autofs-5.1.5
135b98
 - use single unlink_umount_tree() for both direct and indirect mounts.
135b98
 - move unlink_mount_tree() to lib/mounts.c.
135b98
 - use local_getmntent_r() for unlink_mount_tree().
135b98
+- use local getmntent_r() in get_mnt_list().
135b98
 
135b98
 19/12/2017 autofs-5.1.4
135b98
 - fix spec file url.
135b98
--- autofs-5.1.4.orig/lib/mounts.c
135b98
+++ autofs-5.1.4/lib/mounts.c
135b98
@@ -956,14 +956,14 @@ struct mnt_list *get_mnt_list(const char
135b98
 	if (!path || !pathlen || pathlen > PATH_MAX)
135b98
 		return NULL;
135b98
 
135b98
-	tab = open_setmntent_r(_PROC_MOUNTS);
135b98
+	tab = open_fopen_r(_PROC_MOUNTS);
135b98
 	if (!tab) {
135b98
 		char *estr = strerror_r(errno, buf, PATH_MAX - 1);
135b98
-		logerr("setmntent: %s", estr);
135b98
+		logerr("fopen: %s", estr);
135b98
 		return NULL;
135b98
 	}
135b98
 
135b98
-	while ((mnt = getmntent_r(tab, &mnt_wrk, buf, PATH_MAX * 3))) {
135b98
+	while ((mnt = local_getmntent_r(tab, &mnt_wrk, buf, PATH_MAX * 3))) {
135b98
 		len = strlen(mnt->mnt_dir);
135b98
 
135b98
 		if ((!include && len <= pathlen) ||
135b98
@@ -1020,7 +1020,7 @@ struct mnt_list *get_mnt_list(const char
135b98
 				ent->flags |= MNTS_OFFSET;
135b98
 		}
135b98
 	}
135b98
-	endmntent(tab);
135b98
+	fclose(tab);
135b98
 
135b98
 	return list;
135b98
 }