CVS User Account cvsuser
Wed Mar 29 09:02:38 PST 2006
Log Message:
-----------
Bug #885 - CREATE SET causes slonik segfault if no comment is provided.

A default comment has been added for those that are too unimaginative to include one...

Modified Files:
--------------
    slony1-engine/src/slonik:
        slonik.c (r1.63 -> r1.64)

-------------- next part --------------
Index: slonik.c
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/slonik/slonik.c,v
retrieving revision 1.63
retrieving revision 1.64
diff -Lsrc/slonik/slonik.c -Lsrc/slonik/slonik.c -u -w -r1.63 -r1.64
--- src/slonik/slonik.c
+++ src/slonik/slonik.c
@@ -3174,11 +3174,13 @@
 }
 
 
+#define CREATESET_DEFCOMMENT "A replication set so boring no one thought to give it a name"
 int
 slonik_create_set(SlonikStmt_create_set * stmt)
 {
 	SlonikAdmInfo *adminfo1;
 	SlonDString query;
+	const char *comment;
 
 	adminfo1 = get_active_adminfo((SlonikStmt *) stmt, stmt->set_origin);
 	if (adminfo1 == NULL)
@@ -3187,12 +3189,17 @@
 	if (db_begin_xact((SlonikStmt *) stmt, adminfo1) < 0)
 		return -1;
 
+	if (stmt->set_comment == NULL)
+		comment = CREATESET_DEFCOMMENT;
+	else
+		comment = stmt->set_comment;
+
 	dstring_init(&query);
 
 	slon_mkquery(&query,
 				 "select \"_%s\".storeSet(%d, '%q'); ",
 				 stmt->hdr.script->clustername,
-				 stmt->set_id, stmt->set_comment);
+		     stmt->set_id, comment);
 	if (db_exec_evcommand((SlonikStmt *) stmt, adminfo1, &query) < 0)
 	{
 		dstring_free(&query);



More information about the Slony1-commit mailing list