mirror of
				https://github.com/cuberite/polarssl.git
				synced 2025-11-03 12:11:27 -05:00 
			
		
		
		
	Don't exit mbedtls_net_poll on interruption of select
If the select UNIX system call is interrupted by a signal handler, it is not automatically restarted but returns EINTR. This commit modifies the use of select in mbedtls_net_poll from net_sockets.c to retry the select call in this case.
This commit is contained in:
		
							parent
							
								
									adfa64f0c4
								
							
						
					
					
						commit
						9ac640326b
					
				@ -470,8 +470,11 @@ int mbedtls_net_poll( mbedtls_net_context *ctx, uint32_t rw, uint32_t timeout )
 | 
			
		||||
    tv.tv_sec  = timeout / 1000;
 | 
			
		||||
    tv.tv_usec = ( timeout % 1000 ) * 1000;
 | 
			
		||||
 | 
			
		||||
    ret = select( fd + 1, &read_fds, &write_fds, NULL,
 | 
			
		||||
                  timeout == (uint32_t) -1 ? NULL : &tv );
 | 
			
		||||
    do
 | 
			
		||||
    {
 | 
			
		||||
        ret = select( fd + 1, &read_fds, &write_fds, NULL,
 | 
			
		||||
                      timeout == (uint32_t) -1 ? NULL : &tv );
 | 
			
		||||
    } while( ret == EINTR );
 | 
			
		||||
 | 
			
		||||
    if( ret < 0 )
 | 
			
		||||
        return( MBEDTLS_ERR_NET_POLL_FAILED );
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user