*** a/src/bin/pg_basebackup/receivelog.c
--- b/src/bin/pg_basebackup/receivelog.c
***************
*** 1094,1107 **** CopyStreamReceive(PGconn *conn, long timeout, char **buffer)
  		 * No data available. Wait for some to appear, but not longer than
  		 * the specified timeout, so that we can ping the server.
  		 */
! 		if (timeout > 0)
! 		{
! 			int		ret;
  
! 			ret = CopyStreamPoll(conn, timeout);
! 			if (ret <= 0)
! 				return ret;
! 		}
  
  		/* Else there is actually data on the socket */
  		if (PQconsumeInput(conn) == 0)
--- 1094,1104 ----
  		 * No data available. Wait for some to appear, but not longer than
  		 * the specified timeout, so that we can ping the server.
  		 */
! 		int		ret;
  
! 		ret = CopyStreamPoll(conn, timeout);
! 		if (ret <= 0)
! 			return ret;
  
  		/* Else there is actually data on the socket */
  		if (PQconsumeInput(conn) == 0)
