You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

109 lines
2.5 KiB

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