Blame SOURCES/autofs-5.0.7-fix-dumpmaps-multi-output.patch

4d476f
autofs-5.0.7 - fix dumpmaps multi output
4d476f
4d476f
From: Ian Kent <raven@themaw.net>
4d476f
4d476f
If the maps contain the old style "multi" type the dumped map information
4d476f
isn't right.
4d476f
---
4d476f
 CHANGELOG    |    1 
4d476f
 lib/master.c |   61 +++++++++++++++++++++++++++++++++++++++++++++++------------
4d476f
 2 files changed, 50 insertions(+), 12 deletions(-)
4d476f
4d476f
--- autofs-5.0.7.orig/CHANGELOG
4d476f
+++ autofs-5.0.7/CHANGELOG
4d476f
@@ -58,6 +58,7 @@
4d476f
 - add after sssd dependency to unit file.
4d476f
 - fix syncronize handle_mounts() shutdown.
4d476f
 - fix fix wildcard multi map regression.
4d476f
+- fix dumpmaps multi output.
4d476f
 
4d476f
 25/07/2012 autofs-5.0.7
4d476f
 =======================
4d476f
--- autofs-5.0.7.orig/lib/master.c
4d476f
+++ autofs-5.0.7/lib/master.c
4d476f
@@ -1281,6 +1281,54 @@ static void list_source_instances(struct
4d476f
 	return;
4d476f
 }
4d476f
 
4d476f
+static void print_map_info(struct map_source *source)
4d476f
+{
4d476f
+	int argc = source->argc;
4d476f
+	int i, multi, map_num;
4d476f
+
4d476f
+	multi = (source->type && !strcmp(source->type, "multi"));
4d476f
+	map_num = 1;
4d476f
+	for (i = 0; i < argc; i++) {
4d476f
+		if (source->argv[i] && *source->argv[i] != '-') {
4d476f
+			if (!multi)
4d476f
+				printf("  map: %s\n", source->argv[i]);
4d476f
+			else
4d476f
+				printf("  map[%i]: %s\n", map_num, source->argv[i]);
4d476f
+			i++;
4d476f
+		}
4d476f
+
4d476f
+		if (i >= argc)
4d476f
+			return;
4d476f
+
4d476f
+		if (!strcmp(source->argv[i], "--"))
4d476f
+			continue;
4d476f
+
4d476f
+		if (source->argv[i]) {
4d476f
+			int need_newline = 0;
4d476f
+			int j;
4d476f
+
4d476f
+			if (!multi)
4d476f
+				printf("  arguments:");
4d476f
+			else
4d476f
+				printf("  arguments[%i]:", map_num);
4d476f
+
4d476f
+			for (j = i; j < source->argc; j++) {
4d476f
+				if (!strcmp(source->argv[j], "--"))
4d476f
+					break;
4d476f
+				printf(" %s", source->argv[j]);
4d476f
+				i++;
4d476f
+				need_newline = 1;
4d476f
+			}
4d476f
+			if (need_newline)
4d476f
+				printf("\n");
4d476f
+		}
4d476f
+		if (multi)
4d476f
+			map_num++;
4d476f
+	}
4d476f
+
4d476f
+	return;
4d476f
+}
4d476f
+
4d476f
 int master_show_mounts(struct master *master)
4d476f
 {
4d476f
 	struct list_head *p, *head;
4d476f
@@ -1311,7 +1359,6 @@ int master_show_mounts(struct master *ma
4d476f
 		struct autofs_point *ap;
4d476f
 		time_t now = time(NULL);
4d476f
 		unsigned int count = 0;
4d476f
-		int i;
4d476f
 
4d476f
 		this = list_entry(p, struct master_mapent, list);
4d476f
 		p = p->next;
4d476f
@@ -1357,20 +1404,10 @@ int master_show_mounts(struct master *ma
4d476f
 			}
4d476f
 
4d476f
 			if (source->argc >= 1) {
4d476f
-				i = 0;
4d476f
-				if (source->argv[0] && *source->argv[0] != '-') {
4d476f
-					printf("  map: %s\n", source->argv[0]);
4d476f
-					i = 1;
4d476f
-				}
4d476f
+				print_map_info(source);
4d476f
 				if (count && ap->type == LKP_INDIRECT)
4d476f
 					printf("  duplicate indirect map entry"
4d476f
 					       " will be ignored at run time\n");
4d476f
-				if (source->argc > 1) {
4d476f
-					printf("  arguments: ");
4d476f
-					for (; i < source->argc; i++)
4d476f
-						printf("%s ", source->argv[i]);
4d476f
-					printf("\n");
4d476f
-				}
4d476f
 			}
4d476f
 
4d476f
 			printf("\n");