Blob Blame History Raw
autofs-5.1.6 - fix empty mounts list return from unlink_mount_tree()

From: Ian Kent <raven@themaw.net>

If there are no appropriate mounts found by get_mnt_list() then
unlink_mount_tree() should return 1 not 0 since if there are no
mounts to umount this shouldn't cause a failure return.

Also, if a real error occurs in get_mnt_list() we should check for
it and return a failure from unlink_mount_tree() since that would
be mount table not found or out of memory. If that's ignored things
would only get worse from that point.

Signed-off-by: Ian Kent <raven@themaw.net>
---
 CHANGELOG    |    1 +
 lib/mounts.c |    8 ++++++--
 2 files changed, 7 insertions(+), 2 deletions(-)

--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -111,6 +111,7 @@ xx/xx/2018 autofs-5.1.5
 - use a valid timeout in lookup_prune_one_cache().
 - dont prune offset map entries.
 - simplify sss source stale check.
+- fix empty mounts list return from unlink_mount_tree().
 
 19/12/2017 autofs-5.1.4
 - fix spec file url.
--- autofs-5.1.4.orig/lib/mounts.c
+++ autofs-5.1.4/lib/mounts.c
@@ -954,9 +954,13 @@ int unlink_mount_tree(struct autofs_poin
 	struct mnt_list *mnts, *mnt;
 	int rv, ret = 1;
 
+	errno = 0;
 	mnts = get_mnt_list(mp, 1);
-	if (!mnts)
-		return 0;
+	if (!mnts) {
+		if (errno)
+			return 0;
+		return 1;
+	}
 
 	for (mnt = mnts; mnt; mnt = mnt->next) {
 		if (mnt->flags & MNTS_AUTOFS)