If a config option is terminated with EOF, the loop is terminated before
the values are stored. So, I check for parse_start==2 outside the loop,
and if true, store the config variables.
I also attached slony-test.diff which can be used to see what values are
acutally being stored from the configuration file. This can be used for
debugging.
Regards,
Jeff Davis
diff -cr slony1-engine.orig/src/slon/conf-file.l slony1-engine/src/slon/conf-file.l
*** slony1-engine.orig/src/slon/conf-file.l Wed Dec 13 11:11:09 2006
--- slony1-engine/src/slon/conf-file.l Wed Dec 13 11:49:37 2006
***************
*** 218,226 ****
}
tail = item;
}
! parse_state = 0;
! break;
}
}
fclose(fp);
--- 218,262 ----
}
tail = item;
}
! parse_state = 0;
! break;
}
+ }
+ /*
+ * If we encountered an EOF after we've already
+ * reached parse_state of 2, we already have a complete
+ * configuration line, it's just terminated with EOF
+ * instead of EOL. Store that config option.
+ */
+ if(parse_state == 2)
+ {
+ item = malloc(sizeof *item);
+ item->name = opt_name;
+ item->value = opt_value;
+ if (strcmp(opt_name, "custom_variable_classes") == 0)
+ {
+ item->next = head;
+ head = item;
+ if (!tail)
+ {
+ tail = item;
+ }
+ }
+ else
+ {
+ /* append to list */
+ item->next = NULL;
+ if (!head)
+ {
+ head = item;
+ }
+ else
+ {
+ tail->next = item;
+ }
+ tail = item;
+ }
+ parse_state = 0;
}
fclose(fp);
diff -cr slony1-engine.orig/src/slon/conf-file.l slony1-engine.test/src/slon/conf-file.l
*** slony1-engine.orig/src/slon/conf-file.l Wed Dec 13 11:11:09 2006
--- slony1-engine.test/src/slon/conf-file.l Wed Dec 13 11:59:38 2006
***************
*** 234,239 ****
--- 234,240 ----
}
for(item = head; item; item=item->next)
{
+ fprintf(stderr,"Config: %s = '%s'\n",item->name,item->value);
set_config_option(item->name, item->value);
}
diff -cr slony1-engine.orig/src/slon/slon.c slony1-engine.test/src/slon/slon.c
*** slony1-engine.orig/src/slon/slon.c Wed Dec 13 11:11:09 2006
--- slony1-engine.test/src/slon/slon.c Wed Dec 13 11:58:53 2006
***************
*** 179,184 ****
--- 179,185 ----
case 'f':
ProcessConfigFile(optarg);
+ exit(1);
break;
case 'a':
_______________________________________________
Slony1-general mailing list
[email protected]
http://gborg.postgresql.org/mailman/listinfo/slony1-general