CVS User Account cvsuser
Thu Dec 14 07:58:46 PST 2006
Log Message:
-----------
Fix to slon conf file parser (conf-file.l) per Jeff Davis.

There were two problems that could occur on the last line:

1.  The parser couldn't cope with the final line having a comment and no
\n  --> Syntax error

2.  If the final line set a parameter, but didn't have a \n, that
request would get lost

Both issues are fixed with this.

Modified Files:
--------------
    slony1-engine/src/slon:
        conf-file.l (r1.7 -> r1.8)

-------------- next part --------------
Index: conf-file.l
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/slon/conf-file.l,v
retrieving revision 1.7
retrieving revision 1.8
diff -Lsrc/slon/conf-file.l -Lsrc/slon/conf-file.l -u -w -r1.7 -r1.8
--- src/slon/conf-file.l
+++ src/slon/conf-file.l
@@ -67,7 +67,7 @@
 
 \n              ConfigFileLineno++; return SLON_EOL;
 [ \t\r]+        /* eat whitespace */
-#.*$            /* eat comment */
+#.*             /* eat comment */
 
 {ID}            return SLON_ID;
 {QUALIFIED_ID}  return SLON_QUALIFIED_ID;
@@ -222,6 +222,42 @@
 			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);
 



More information about the Slony1-commit mailing list