do not loop on an incomplete io_thread_fd read
No need to loop if less than a full buffer is read, the next read would return EAGAIN. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
		
							parent
							
								
									889ae39c9a
								
							
						
					
					
						commit
						1d0f0d91f2
					
				
							
								
								
									
										4
									
								
								vl.c
								
								
								
								
							
							
						
						
									
										4
									
								
								vl.c
								
								
								
								
							| 
						 | 
				
			
			@ -3229,12 +3229,12 @@ static void qemu_event_read(void *opaque)
 | 
			
		|||
{
 | 
			
		||||
    int fd = (unsigned long)opaque;
 | 
			
		||||
    ssize_t len;
 | 
			
		||||
    char buffer[512];
 | 
			
		||||
 | 
			
		||||
    /* Drain the notify pipe */
 | 
			
		||||
    do {
 | 
			
		||||
        char buffer[512];
 | 
			
		||||
        len = read(fd, buffer, sizeof(buffer));
 | 
			
		||||
    } while ((len == -1 && errno == EINTR) || len > 0);
 | 
			
		||||
    } while ((len == -1 && errno == EINTR) || len == sizeof(buffer));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int qemu_event_init(void)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue