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

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