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

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