Blame SOURCES/autofs-5.1.7-fix-is-mounted-check-on-non-existent-path.patch

beb904
autofs-5.1.7 - fix is mounted check on non existent path
beb904
beb904
From: Ian Kent <raven@themaw.net>
beb904
beb904
When checking if a path is a mount point the case of a non-existent path
beb904
was not being handled.
beb904
beb904
Signed-off-by: Ian Kent <raven@themaw.net>
beb904
---
beb904
 CHANGELOG           |    1 +
beb904
 lib/dev-ioctl-lib.c |    3 +++
beb904
 lib/mounts.c        |   12 +++++++++++-
beb904
 3 files changed, 15 insertions(+), 1 deletion(-)
beb904
beb904
--- autofs-5.1.4.orig/CHANGELOG
beb904
+++ autofs-5.1.4/CHANGELOG
beb904
@@ -5,6 +5,7 @@
beb904
 - use sprintf() when constructing hosts mapent.
beb904
 - fix mnts_remove_amdmount() uses wrong list.
beb904
 - eliminate cache_lookup_offset() usage.
beb904
+- fix is mounted check on non existent path.
beb904
 
beb904
 xx/xx/2018 autofs-5.1.5
beb904
 - fix flag file permission.
beb904
--- autofs-5.1.4.orig/lib/dev-ioctl-lib.c
beb904
+++ autofs-5.1.4/lib/dev-ioctl-lib.c
beb904
@@ -759,6 +759,9 @@ static int dev_ioctl_ismountpoint(unsign
beb904
 		int save_errno = errno;
beb904
 		free_dev_ioctl_path(param);
beb904
 		errno = save_errno;
beb904
+		/* Path doesn't exist */
beb904
+		if (errno == ENOENT)
beb904
+			return 0;
beb904
 		return -1;
beb904
 	}
beb904
 
beb904
--- autofs-5.1.4.orig/lib/mounts.c
beb904
+++ autofs-5.1.4/lib/mounts.c
beb904
@@ -1645,8 +1645,18 @@ static int table_is_mounted(const char *
beb904
 	struct mntent mnt_wrk;
beb904
 	char buf[PATH_MAX * 3];
beb904
 	size_t mp_len = strlen(mp);
beb904
+	struct stat st;
beb904
 	FILE *tab;
beb904
-	int ret = 0;
beb904
+	int ret;
beb904
+
beb904
+	ret = stat(mp, &st);
beb904
+	if (ret == -1) {
beb904
+		if (errno == ENOENT) {
beb904
+			/* Path does not exist */
beb904
+			return 0;
beb904
+		}
beb904
+		ret = 0;
beb904
+	}
beb904
 
beb904
 	if (!mp || !mp_len || mp_len >= PATH_MAX)
beb904
 		return 0;