Blame SOURCES/autofs-5.1.6-fix-empty-mounts-list-return-from-unlink_mount_tree.patch

b8be1a
autofs-5.1.6 - fix empty mounts list return from unlink_mount_tree()
b8be1a
b8be1a
From: Ian Kent <raven@themaw.net>
b8be1a
b8be1a
If there are no appropriate mounts found by get_mnt_list() then
b8be1a
unlink_mount_tree() should return 1 not 0 since if there are no
b8be1a
mounts to umount this shouldn't cause a failure return.
b8be1a
b8be1a
Also, if a real error occurs in get_mnt_list() we should check for
b8be1a
it and return a failure from unlink_mount_tree() since that would
b8be1a
be mount table not found or out of memory. If that's ignored things
b8be1a
would only get worse from that point.
b8be1a
b8be1a
Signed-off-by: Ian Kent <raven@themaw.net>
b8be1a
---
b8be1a
 CHANGELOG    |    1 +
b8be1a
 lib/mounts.c |    8 ++++++--
b8be1a
 2 files changed, 7 insertions(+), 2 deletions(-)
b8be1a
b8be1a
--- autofs-5.1.4.orig/CHANGELOG
b8be1a
+++ autofs-5.1.4/CHANGELOG
b8be1a
@@ -75,6 +75,7 @@
b8be1a
 - fix direct mount deadlock.
b8be1a
 - fix lookup_prune_one_cache() refactoring change.
b8be1a
 - add missing description of null map option.
b8be1a
+- fix empty mounts list return from unlink_mount_tree().
b8be1a
 
b8be1a
 xx/xx/2018 autofs-5.1.5
b8be1a
 - fix flag file permission.
b8be1a
--- autofs-5.1.4.orig/lib/mounts.c
b8be1a
+++ autofs-5.1.4/lib/mounts.c
b8be1a
@@ -2115,9 +2115,13 @@ int unlink_mount_tree(struct autofs_poin
b8be1a
 	struct mnt_list *mnts, *mnt;
b8be1a
 	int rv, ret = 1;
b8be1a
 
b8be1a
+	errno = 0;
b8be1a
 	mnts = get_mnt_list(mp, 1);
b8be1a
-	if (!mnts)
b8be1a
-		return 0;
b8be1a
+	if (!mnts) {
b8be1a
+		if (errno)
b8be1a
+			return 0;
b8be1a
+		return 1;
b8be1a
+	}
b8be1a
 
b8be1a
 	for (mnt = mnts; mnt; mnt = mnt->next) {
b8be1a
 		if (mnt->flags & MNTS_AUTOFS)