Index: src/backend/access/transam/xlog.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v
retrieving revision 1.322
diff -c -r1.322 xlog.c
*** src/backend/access/transam/xlog.c	9 Nov 2008 17:51:15 -0000	1.322
--- src/backend/access/transam/xlog.c	2 Dec 2008 20:10:03 -0000
***************
*** 6674,6679 ****
--- 6674,6680 ----
  	char		histfilepath[MAXPGPATH];
  	char		startxlogfilename[MAXFNAMELEN];
  	char		stopxlogfilename[MAXFNAMELEN];
+ 	char		lastxlogfilename[MAXFNAMELEN];
  	uint32		_logId;
  	uint32		_logSeg;
  	FILE	   *lfp;
***************
*** 6711,6716 ****
--- 6712,6720 ----
  	XLByteToSeg(stoppoint, _logId, _logSeg);
  	XLogFileName(stopxlogfilename, ThisTimeLineID, _logId, _logSeg);
  
+ 	XLByteToPrevSeg(stoppoint, _logId, _logSeg);
+ 	XLogFileName(lastxlogfilename, ThisTimeLineID, _logId, _logSeg);
+ 
  	/* Use the log timezone here, not the session timezone */
  	stamp_time = (pg_time_t) time(NULL);
  	pg_strftime(strfbuf, sizeof(strfbuf),
***************
*** 6801,6813 ****
  	 * we assume the admin wanted his backup to work completely. If you
  	 * don't wish to wait, you can set statement_timeout.
  	 */
- 	BackupHistoryFileName(histfilepath, ThisTimeLineID, _logId, _logSeg,
- 						  startpoint.xrecoff % XLogSegSize);
- 
  	seconds_before_warning = 60;
  	waits = 0;
  
! 	while (XLogArchiveIsBusy(stopxlogfilename) ||
  		   XLogArchiveIsBusy(histfilepath))
  	{
  		CHECK_FOR_INTERRUPTS();
--- 6805,6814 ----
  	 * we assume the admin wanted his backup to work completely. If you
  	 * don't wish to wait, you can set statement_timeout.
  	 */
  	seconds_before_warning = 60;
  	waits = 0;
  
! 	while (XLogArchiveIsBusy(lastxlogfilename) ||
  		   XLogArchiveIsBusy(histfilepath))
  	{
  		CHECK_FOR_INTERRUPTS();
