CVS User Account cvsuser
Mon Oct 23 14:56:10 PDT 2006
Log Message:
-----------
Three changes:

1.  Allocate an extra entry in sync_group - SlonWorkMsg_event *sync_group[MAXGROUPSIZE+1];

That way, we can get the value of sync_group_size all the way to
MAXGROUPSIZE and not blow out the end of the array.

2.  Add into the while loop that increments sync_group_size a check that we haven't
exceeded MAXGROUPSIZE.

That way we won't blow past the end of the array if next_sync_group_size gets set too
high.

3.  Logic for processing return code from fclose() treats "nonzero" as the error
condition as per H&S Section 15.2

Modified Files:
--------------
    slony1-engine/src/slon:
        remote_worker.c (r1.124 -> r1.125)

-------------- next part --------------
Index: remote_worker.c
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/slon/remote_worker.c,v
retrieving revision 1.124
retrieving revision 1.125
diff -Lsrc/slon/remote_worker.c -Lsrc/slon/remote_worker.c -u -w -r1.124 -r1.125
--- src/slon/remote_worker.c
+++ src/slon/remote_worker.c
@@ -463,7 +463,7 @@
 		 */
 		if (strcmp(event->ev_type, "SYNC") == 0)
 		{
-			SlonWorkMsg_event *sync_group[MAXGROUPSIZE];
+			SlonWorkMsg_event *sync_group[MAXGROUPSIZE+1];
 			int			sync_group_size;
 
 			int			seconds;
@@ -544,7 +544,7 @@
 				gettimeofday(&sync_start, NULL);
 
 				pthread_mutex_lock(&(node->message_lock));
-				while (sync_group_size < next_sync_group_size && node->message_head != NULL)
+				while (sync_group_size < next_sync_group_size && sync_group_size < MAXGROUPSIZE && node->message_head != NULL)
 				{
 					if (node->message_head->msg_type != WMSG_EVENT)
 						break;
@@ -5827,7 +5827,7 @@
 			return -1;
 		rc = fclose(archive_fp);
 		archive_fp = NULL;
-		if (rc < 0)
+		if (rc != 0)
 			return -1;
 		rc = rename(archive_tmp, archive_name);
 	}



More information about the Slony1-commit mailing list