diff -ruN postgresql-7.4.13-old/src/pgcluster/pgrp/replicate.c postgresql-7.4.13/src/pgcluster/pgrp/replicate.c
--- postgresql-7.4.13-old/src/pgcluster/pgrp/replicate.c	2006-08-13 19:31:09.000000000 +0200
+++ postgresql-7.4.13/src/pgcluster/pgrp/replicate.c	2006-08-13 20:32:06.000000000 +0200
@@ -869,6 +869,13 @@
 	/*
 	 * create message queue
 	 */
+	PGconnMsgid = msgget (IPC_PRIVATE, 00666 | IPC_CREAT );
+	if (PGconnMsgid < 0)
+	{
+		show_error("%s,msgget() failed. (%s)",func,strerror(errno));
+		return STATUS_ERROR;
+	}
+
 	QueryLogMsgid = msgget (IPC_PRIVATE, 00666 | IPC_CREAT );
 	if (QueryLogMsgid < 0)
 	{
@@ -985,6 +992,7 @@
 	if (PGconnMsgid >= 0)
 	{
 		msgctl(PGconnMsgid, IPC_RMID,(struct msqid_ds *)NULL);
+		PGconnMsgid = -1;
 	}
 
 	if (QueryLogMsgid >= 0)
