autofs-5.1.6 - fix empty mounts list return from unlink_mount_tree() From: Ian Kent 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 --- CHANGELOG | 1 + lib/mounts.c | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 439ab210..b2923aa5 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -74,6 +74,7 @@ xx/xx/2020 autofs-5.1.7 - move AUTOFS_LIB to end of build rule lines. - make autofs.a a shared library. - make lookup_file.c nss map read status return handling consistent. +- fix empty mounts list return from unlink_mount_tree(). 07/10/2019 autofs-5.1.6 - support strictexpire mount option. diff --git a/lib/mounts.c b/lib/mounts.c index f823a3d6..dbeb77b5 100644 --- a/lib/mounts.c +++ b/lib/mounts.c @@ -1501,9 +1501,13 @@ int unlink_mount_tree(struct autofs_point *ap, const char *mp) 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)