diff options
Diffstat (limited to 'config.c')
-rw-r--r-- | config.c | 21 |
1 files changed, 13 insertions, 8 deletions
@@ -709,8 +709,6 @@ void free_domain(struct domain_ent *de) } if (de->spare_group) free(de->spare_group); - if (de->program) - free(de->program); if (de->table) free(de->table); free(de); @@ -731,7 +729,7 @@ void domainline(char *line) } de->paths = NULL; de->spare_group = NULL; - de->program = NULL; + de->handler = NULL; de->table = NULL; de->action = incremental; de->st = NULL; @@ -813,6 +811,8 @@ void domainline(char *line) return; } } else if (strncasecmp("program=", w, 8) == 0) { + int i = 0; + struct partition_handler *h = partition_list[i]; if (!p_seen) p_seen = 1; else { @@ -821,13 +821,18 @@ void domainline(char *line) "ignoring\n"); continue; } - de->program = strdup(w+8); - if (!de->program) { - fprintf(stderr, Name ": failed to allocate " - "memory for program\n"); + while(h) { + if (strncasecmp(w+8, h->match, strlen(h->match)) == 0) + break; + h = partition_list[++i]; + } + if (!h) { + fprintf(stderr, Name ": failed to recognize " + "program %s\n", w+8); free_domain(de); return; } + de->handler = h; } else if (strncasecmp("table=", w, 6) == 0) { if (!t_seen) t_seen = 1; @@ -893,7 +898,7 @@ void domainline(char *line) free_domain(de); return; } - if (!de->table || !de->program) { + if (!de->table || !de->handler) { fprintf(stderr, Name ": partition action requires " "both a table and program setting.\n"); free_domain(de); |