Index: src/interfaces/libpq/fe-connect.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/interfaces/libpq/fe-connect.c,v
retrieving revision 1.208
diff -c -c -r1.208 fe-connect.c
*** src/interfaces/libpq/fe-connect.c	11 Oct 2002 04:41:59 -0000	1.208
--- src/interfaces/libpq/fe-connect.c	14 Oct 2002 17:10:19 -0000
***************
*** 1071,1085 ****
  			conn->status = CONNECTION_BAD;
  			return 0;
  		}
! 		remains.tv_usec = 0;
  		rp = &remains;
  
  		/* calculate the finish time based on start + timeout */
  		finish_time = time((time_t *) NULL) + remains.tv_sec;
  	}
  
! 	while (rp == NULL || remains.tv_sec > 0 ||
! 		   (remains.tv_sec == 0 && remains.tv_usec > 0))
  	{
  		/*
  		 * Wait, if necessary.	Note that the initial state (just after
--- 1071,1084 ----
  			conn->status = CONNECTION_BAD;
  			return 0;
  		}
! 		remains.tv_usec = 0;	/* We don't use subsecond timing */
  		rp = &remains;
  
  		/* calculate the finish time based on start + timeout */
  		finish_time = time((time_t *) NULL) + remains.tv_sec;
  	}
  
! 	while (rp == NULL || remains.tv_sec > 0)
  	{
  		/*
  		 * Wait, if necessary.	Note that the initial state (just after
***************
*** 1133,1139 ****
  			}
  
  			remains.tv_sec = finish_time - current_time;
- 			remains.tv_usec = 0;
  		}
  	}
  	conn->status = CONNECTION_BAD;
--- 1132,1137 ----
Index: src/interfaces/libpq/fe-misc.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/interfaces/libpq/fe-misc.c,v
retrieving revision 1.80
diff -c -c -r1.80 fe-misc.c
*** src/interfaces/libpq/fe-misc.c	3 Oct 2002 17:09:42 -0000	1.80
--- src/interfaces/libpq/fe-misc.c	14 Oct 2002 17:10:22 -0000
***************
*** 783,796 ****
  }
  
  int
! pqWaitTimed(int forRead, int forWrite, PGconn *conn, const struct timeval * timeout)
  {
  	fd_set		input_mask;
  	fd_set		output_mask;
  	fd_set		except_mask;
  
  	struct timeval tmp_timeout;
- 	struct timeval *ptmp_timeout = NULL;
  
  	if (conn->sock < 0)
  	{
--- 783,795 ----
  }
  
  int
! pqWaitTimed(int forRead, int forWrite, PGconn *conn, const struct timeval *timeout)
  {
  	fd_set		input_mask;
  	fd_set		output_mask;
  	fd_set		except_mask;
  
  	struct timeval tmp_timeout;
  
  	if (conn->sock < 0)
  	{
***************
*** 823,836 ****
  		if (NULL != timeout)
  		{
  			/*
! 			 * select may modify timeout argument on some platforms use
! 			 * copy
  			 */
  			tmp_timeout = *timeout;
- 			ptmp_timeout = &tmp_timeout;
  		}
  		if (select(conn->sock + 1, &input_mask, &output_mask,
! 				   &except_mask, ptmp_timeout) < 0)
  		{
  			if (SOCK_ERRNO == EINTR)
  				goto retry5;
--- 822,834 ----
  		if (NULL != timeout)
  		{
  			/*
! 			 * 	select() may modify timeout argument on some platforms so
! 			 *	use copy
  			 */
  			tmp_timeout = *timeout;
  		}
  		if (select(conn->sock + 1, &input_mask, &output_mask,
! 				   &except_mask, &tmp_timeout) < 0)
  		{
  			if (SOCK_ERRNO == EINTR)
  				goto retry5;
Index: src/interfaces/libpq/libpq-int.h
===================================================================
RCS file: /cvsroot/pgsql-server/src/interfaces/libpq/libpq-int.h,v
retrieving revision 1.58
diff -c -c -r1.58 libpq-int.h
*** src/interfaces/libpq/libpq-int.h	3 Oct 2002 17:09:42 -0000	1.58
--- src/interfaces/libpq/libpq-int.h	14 Oct 2002 17:10:24 -0000
***************
*** 340,346 ****
  extern int	pqFlush(PGconn *conn);
  extern int	pqSendSome(PGconn *conn);
  extern int	pqWait(int forRead, int forWrite, PGconn *conn);
! extern int	pqWaitTimed(int forRead, int forWrite, PGconn *conn, const struct timeval * timeout);
  extern int	pqReadReady(PGconn *conn);
  extern int	pqWriteReady(PGconn *conn);
  
--- 340,346 ----
  extern int	pqFlush(PGconn *conn);
  extern int	pqSendSome(PGconn *conn);
  extern int	pqWait(int forRead, int forWrite, PGconn *conn);
! extern int	pqWaitTimed(int forRead, int forWrite, PGconn *conn, const struct timeval *timeout);
  extern int	pqReadReady(PGconn *conn);
  extern int	pqWriteReady(PGconn *conn);
  
