|
|
96dc52 |
autofs-5.1.7 - fix is mounted check on non existent path
|
|
|
96dc52 |
|
|
|
96dc52 |
From: Ian Kent <raven@themaw.net>
|
|
|
96dc52 |
|
|
|
96dc52 |
When checking if a path is a mount point the case of a non-existent path
|
|
|
96dc52 |
was not being handled.
|
|
|
96dc52 |
|
|
|
96dc52 |
Signed-off-by: Ian Kent <raven@themaw.net>
|
|
|
96dc52 |
---
|
|
|
96dc52 |
CHANGELOG | 1 +
|
|
|
96dc52 |
lib/dev-ioctl-lib.c | 3 +++
|
|
|
96dc52 |
lib/mounts.c | 12 +++++++++++-
|
|
|
96dc52 |
3 files changed, 15 insertions(+), 1 deletion(-)
|
|
|
96dc52 |
|
|
|
96dc52 |
diff --git a/CHANGELOG b/CHANGELOG
|
|
|
96dc52 |
index 484bd866..e55fd66a 100644
|
|
|
96dc52 |
--- a/CHANGELOG
|
|
|
96dc52 |
+++ b/CHANGELOG
|
|
|
96dc52 |
@@ -6,6 +6,7 @@
|
|
|
96dc52 |
- fix mnts_remove_amdmount() uses wrong list.
|
|
|
96dc52 |
- Fix option for master read wait.
|
|
|
96dc52 |
- eliminate cache_lookup_offset() usage.
|
|
|
96dc52 |
+- fix is mounted check on non existent path.
|
|
|
96dc52 |
|
|
|
96dc52 |
25/01/2021 autofs-5.1.7
|
|
|
96dc52 |
- make bind mounts propagation slave by default.
|
|
|
96dc52 |
diff --git a/lib/dev-ioctl-lib.c b/lib/dev-ioctl-lib.c
|
|
|
96dc52 |
index e8519236..7040c3da 100644
|
|
|
96dc52 |
--- a/lib/dev-ioctl-lib.c
|
|
|
96dc52 |
+++ b/lib/dev-ioctl-lib.c
|
|
|
96dc52 |
@@ -759,6 +759,9 @@ static int dev_ioctl_ismountpoint(unsigned int logopt,
|
|
|
96dc52 |
int save_errno = errno;
|
|
|
96dc52 |
free_dev_ioctl_path(param);
|
|
|
96dc52 |
errno = save_errno;
|
|
|
96dc52 |
+ /* Path doesn't exist */
|
|
|
96dc52 |
+ if (errno == ENOENT)
|
|
|
96dc52 |
+ return 0;
|
|
|
96dc52 |
return -1;
|
|
|
96dc52 |
}
|
|
|
96dc52 |
|
|
|
96dc52 |
diff --git a/lib/mounts.c b/lib/mounts.c
|
|
|
96dc52 |
index 42e8ef07..fe931b20 100644
|
|
|
96dc52 |
--- a/lib/mounts.c
|
|
|
96dc52 |
+++ b/lib/mounts.c
|
|
|
96dc52 |
@@ -1649,8 +1649,18 @@ static int table_is_mounted(const char *mp, unsigned int type)
|
|
|
96dc52 |
struct mntent mnt_wrk;
|
|
|
96dc52 |
char buf[PATH_MAX * 3];
|
|
|
96dc52 |
size_t mp_len = strlen(mp);
|
|
|
96dc52 |
+ struct stat st;
|
|
|
96dc52 |
FILE *tab;
|
|
|
96dc52 |
- int ret = 0;
|
|
|
96dc52 |
+ int ret;
|
|
|
96dc52 |
+
|
|
|
96dc52 |
+ ret = stat(mp, &st);
|
|
|
96dc52 |
+ if (ret == -1) {
|
|
|
96dc52 |
+ if (errno == ENOENT) {
|
|
|
96dc52 |
+ /* Path does not exist */
|
|
|
96dc52 |
+ return 0;
|
|
|
96dc52 |
+ }
|
|
|
96dc52 |
+ ret = 0;
|
|
|
96dc52 |
+ }
|
|
|
96dc52 |
|
|
|
96dc52 |
if (!mp || !mp_len || mp_len >= PATH_MAX)
|
|
|
96dc52 |
return 0;
|