Steve Singer,,, ssinger at lists.slony.info
Mon Jun 28 08:46:31 PDT 2010
Update of /home/cvsd/slony1/slony1-engine/src/slon
In directory main.slony.info:/tmp/cvs-serv19701/src/slon

Modified Files:
	scheduler.c 
Log Message:
Fix for bug #104
Check for NULL file descriptors before performing actions on them.

Merging from 2.0 STABLE branch



Index: scheduler.c
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/slon/scheduler.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -C 2 -d -r1.30 -r1.31
*** scheduler.c	17 Aug 2009 17:25:50 -0000	1.30
--- scheduler.c	28 Jun 2010 15:46:29 -0000	1.31
***************
*** 57,61 ****
   * ----------
   */
! static void *sched_mainloop(void *);
  static void sched_add_fdset(int fd, fd_set * fds);
  static void sched_remove_fdset(int fd, fd_set * fds);
--- 57,61 ----
   * ----------
   */
! static void *sched_mainloop(void* );
  static void sched_add_fdset(int fd, fd_set * fds);
  static void sched_remove_fdset(int fd, fd_set * fds);
***************
*** 73,77 ****
   */
  int
! sched_start_mainloop(void)
  {
  	sched_status = SCHED_STATUS_OK;
--- 73,77 ----
   */
  int
! sched_start_mainloop(void )
  {
  	sched_status = SCHED_STATUS_OK;
***************
*** 192,196 ****
  {
  	ScheduleStatus			rc;
! 
  	/*
  	 * Grab the master lock and check that we're in normal runmode
--- 192,196 ----
  {
  	ScheduleStatus			rc;
! 	int                     fds;
  	/*
  	 * Grab the master lock and check that we're in normal runmode
***************
*** 209,215 ****
  	conn->condition = condition;
  	if (condition & SCHED_WAIT_SOCK_READ)
! 		sched_add_fdset(PQsocket(conn->dbconn), &sched_fdset_read);
  	if (condition & SCHED_WAIT_SOCK_WRITE)
! 		sched_add_fdset(PQsocket(conn->dbconn), &sched_fdset_write);
  
  	/*
--- 209,221 ----
  	conn->condition = condition;
  	if (condition & SCHED_WAIT_SOCK_READ)
! 	{
! 		fds = PQsocket(conn->dbconn);
! 		sched_add_fdset(fds, &sched_fdset_read);
! 	}
  	if (condition & SCHED_WAIT_SOCK_WRITE)
! 	{
! 		fds = PQsocket(conn->dbconn);
! 		sched_add_fdset(fds, &sched_fdset_write);
! 	}
  
  	/*
***************
*** 383,387 ****
   */
  static void *
! sched_mainloop(void *dummy)
  {
  	fd_set		rfds;
--- 389,393 ----
   */
  static void *
! sched_mainloop(void * dummy)
  {
  	fd_set		rfds;
***************
*** 679,685 ****
  sched_add_fdset(int fd, fd_set * fds)
  {
! 	FD_SET(fd, fds);
! 	if (fd >= sched_numfd)
! 		sched_numfd = fd + 1;
  }
  
--- 685,694 ----
  sched_add_fdset(int fd, fd_set * fds)
  {
! 	if( fds != NULL )
! 	{
! 		FD_SET(fd, fds);
! 		if (fd >= sched_numfd)
! 			sched_numfd = fd + 1;
! 	}
  }
  



More information about the Slony1-commit mailing list