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

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