mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	Fix unportable coding in DetermineSleepTime().
We should not assume that struct timeval.tv_sec is a long, because it ain't necessarily. (POSIX says that it's a time_t, which might well be 64 bits now or in the future; or for that matter might be 32 bits on machines with 64-bit longs.) Per buildfarm member panther. Back-patch to 9.3 where the dubious coding was introduced.
This commit is contained in:
		@@ -1478,10 +1478,12 @@ DetermineSleepTime(struct timeval * timeout)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if (next_wakeup != 0)
 | 
						if (next_wakeup != 0)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
 | 
							long		secs;
 | 
				
			||||||
		int			microsecs;
 | 
							int			microsecs;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		TimestampDifference(GetCurrentTimestamp(), next_wakeup,
 | 
							TimestampDifference(GetCurrentTimestamp(), next_wakeup,
 | 
				
			||||||
							&timeout->tv_sec, µsecs);
 | 
												&secs, µsecs);
 | 
				
			||||||
 | 
							timeout->tv_sec = secs;
 | 
				
			||||||
		timeout->tv_usec = microsecs;
 | 
							timeout->tv_usec = microsecs;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/* Ensure we don't exceed one minute */
 | 
							/* Ensure we don't exceed one minute */
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user