Steve Singer,,, ssinger at lists.slony.info
Wed Mar 31 07:12:04 PDT 2010
Update of /home/cvsd/slony1/slony1-engine/src/slon
In directory main.slony.info:/tmp/cvs-serv15656/src/slon

Modified Files:
      Tag: REL_2_0_STABLE
	misc.c 
Log Message:
Perform a va_copy and use the copy in the loop that uses va_args.
You are not allowed to use va_args multiple times.

Fix for bug # 55

Patch submitted by Paul Cannon



Index: misc.c
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/slon/misc.c,v
retrieving revision 1.26.2.4
retrieving revision 1.26.2.5
diff -C 2 -d -r1.26.2.4 -r1.26.2.5
*** misc.c	11 Feb 2010 20:50:45 -0000	1.26.2.4
--- misc.c	31 Mar 2010 14:12:02 -0000	1.26.2.5
***************
*** 189,194 ****
  
  	off = (int) strlen(outbuf);
! 
! 	while (vsnprintf(&outbuf[off], (size_t) (outsize - off), fmt, ap) >= outsize - off - 1)
  	{
  		outsize *= 2;
--- 189,195 ----
  
  	off = (int) strlen(outbuf);
! 	va_list apcopy;
! 	va_copy(apcopy,ap);
! 	while (vsnprintf(&outbuf[off], (size_t) (outsize - off), fmt, apcopy) >= outsize - off - 1)
  	{
  		outsize *= 2;
***************
*** 199,203 ****
--- 200,209 ----
  			slon_retry();
  		}
+ 		va_end(apcopy);
+ 		va_copy(apcopy, ap);
  	}
+ 
+ 	va_end(apcopy);
+ 
  #ifdef HAVE_SYSLOG
  	if (Use_syslog >= 1)



More information about the Slony1-commit mailing list