Blob Blame History Raw
autofs-5.0.7 - make dump maps check for duplicate indirect mounts

From: Ian Kent <raven@themaw.net>

The dumpmaps function was intended for users to find out how the configured
mounts would be seen by automount. It does a limited amount of checking and
in particular doesn't report that duplicate indirect map sources will be
ignored at runtime.
---
 CHANGELOG    |    1 +
 lib/master.c |    7 +++++++
 2 files changed, 8 insertions(+)

diff --git a/CHANGELOG b/CHANGELOG
index 4106e7f..4576d47 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -40,6 +40,7 @@
 - fix some automount(8) typos.
 - syncronize handle_mounts() shutdown.
 - fix submount tree not all expiring.
+- make dump maps check for duplicate indirect mounts.
 
 25/07/2012 autofs-5.0.7
 =======================
diff --git a/lib/master.c b/lib/master.c
index 64dbcb1..eca3523 100644
--- a/lib/master.c
+++ b/lib/master.c
@@ -1310,6 +1310,7 @@ int master_show_mounts(struct master *master)
 		struct master_mapent *this;
 		struct autofs_point *ap;
 		time_t now = time(NULL);
+		unsigned int count = 0;
 		int i;
 
 		this = list_entry(p, struct master_mapent, list);
@@ -1318,6 +1319,7 @@ int master_show_mounts(struct master *master)
 		ap = this->ap;
 
 		printf("\nMount point: %s\n", ap->path);
+
 		printf("\nsource(s):\n");
 
 		/*
@@ -1360,6 +1362,9 @@ int master_show_mounts(struct master *master)
 					printf("  map: %s\n", source->argv[0]);
 					i = 1;
 				}
+				if (count && ap->type == LKP_INDIRECT)
+					printf("  duplicate indirect map entry"
+					       " will be ignored at run time\n");
 				if (source->argc > 1) {
 					printf("  arguments: ");
 					for (; i < source->argc; i++)
@@ -1379,6 +1384,8 @@ int master_show_mounts(struct master *master)
 				} while ((me = cache_lookup_next(source->mc, me)));
 			}
 
+			count++;
+
 			source = source->next;
 		}