tcp_close(): check for close() errors too (v2)
In case close() fails, we want to report the error back. Changes v1 -> v2: - Use braces on if statement to match coding style Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
		
							parent
							
								
									e375fe3472
								
							
						
					
					
						commit
						61a5872fd6
					
				| 
						 | 
				
			
			@ -40,12 +40,15 @@ static int socket_write(MigrationState *s, const void * buf, size_t size)
 | 
			
		|||
 | 
			
		||||
static int tcp_close(MigrationState *s)
 | 
			
		||||
{
 | 
			
		||||
    int r = 0;
 | 
			
		||||
    DPRINTF("tcp_close\n");
 | 
			
		||||
    if (s->fd != -1) {
 | 
			
		||||
        close(s->fd);
 | 
			
		||||
        if (close(s->fd) < 0) {
 | 
			
		||||
            r = -errno;
 | 
			
		||||
        }
 | 
			
		||||
        s->fd = -1;
 | 
			
		||||
    }
 | 
			
		||||
    return 0;
 | 
			
		||||
    return r;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void tcp_wait_for_connect(void *opaque)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue