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

135b98
autofs-5.1.5 - use local getmntent_r in table_is_mounted()
135b98
135b98
From: Ian Kent <raven@themaw.net>
135b98
135b98
Use the local_getmntent_r() funtion copied from glibc in the function
135b98
table_is_mounted() so that if glibc is changed to support the autofs
135b98
"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
@@ -67,6 +67,7 @@ xx/xx/2018 autofs-5.1.5
135b98
 - use mp instead of path in mnt_list entries.
135b98
 - always use PROC_MOUNTS to make mount lists.
135b98
 - add glibc getmntent_r().
135b98
+- use local getmntent_r in table_is_mounted().
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
@@ -999,14 +999,14 @@ static int table_is_mounted(const char *
135b98
 	if (!mp || !mp_len || mp_len >= PATH_MAX)
135b98
 		return 0;
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 0;
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
 		size_t len = strlen(mnt->mnt_dir);
135b98
 
135b98
 		if (type) {
135b98
@@ -1028,7 +1028,7 @@ static int table_is_mounted(const char *
135b98
 			break;
135b98
 		}
135b98
 	}
135b98
-	endmntent(tab);
135b98
+	fclose(tab);
135b98
 
135b98
 	return ret;
135b98
 }