diff mbox

[07/12] migration: use closesocket, not close

Message ID 1350555758-29988-8-git-send-email-pbonzini@redhat.com
State New
Headers show

Commit Message

Paolo Bonzini Oct. 18, 2012, 10:22 a.m. UTC
Windows requires this.  Migration does not quite work under Windows
but let's be uniform across QEMU.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 migration-tcp.c | 6 +++---
 1 file modificato, 3 inserzioni(+), 3 rimozioni(-)

Comments

Orit Wasserman Oct. 28, 2012, 9:49 a.m. UTC | #1
On 10/18/2012 12:22 PM, Paolo Bonzini wrote:
> Windows requires this.  Migration does not quite work under Windows
> but let's be uniform across QEMU.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  migration-tcp.c | 6 +++---
>  1 file modificato, 3 inserzioni(+), 3 rimozioni(-)
> 
> diff --git a/migration-tcp.c b/migration-tcp.c
> index 1bd8481..e797d23 100644
> --- a/migration-tcp.c
> +++ b/migration-tcp.c
> @@ -45,7 +45,7 @@ static int tcp_close(MigrationState *s)
>      int r = 0;
>      DPRINTF("tcp_close\n");
>      if (s->fd != -1) {
> -        if (close(s->fd) < 0) {
> +        if (closesocket(s->fd) < 0) {
>              r = -errno;
>          }
>          s->fd = -1;
> @@ -97,7 +97,7 @@ static void tcp_accept_incoming_migration(void *opaque)
>          c = qemu_accept(s, (struct sockaddr *)&addr, &addrlen);
>      } while (c == -1 && socket_error() == EINTR);
>      qemu_set_fd_handler2(s, NULL, NULL, NULL, NULL);
> -    close(s);
> +    closesocket(s);
>  
>      DPRINTF("accepted migration\n");
>  
> @@ -115,7 +115,7 @@ static void tcp_accept_incoming_migration(void *opaque)
>      process_incoming_migration(f);
>      qemu_fclose(f);
>  out:
> -    close(c);
> +    closesocket(c);
>  }
>  
>  int tcp_start_incoming_migration(const char *host_port, Error **errp)
> 
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Juan Quintela Oct. 30, 2012, 12:32 p.m. UTC | #2
Paolo Bonzini <pbonzini@redhat.com> wrote:
> Windows requires this.  Migration does not quite work under Windows
> but let's be uniform across QEMU.

Reviewed-by: Juan Quintela <quintela@redhat.com>

man don't show this function, but it is already used in qemu-char.c, so ...
diff mbox

Patch

diff --git a/migration-tcp.c b/migration-tcp.c
index 1bd8481..e797d23 100644
--- a/migration-tcp.c
+++ b/migration-tcp.c
@@ -45,7 +45,7 @@  static int tcp_close(MigrationState *s)
     int r = 0;
     DPRINTF("tcp_close\n");
     if (s->fd != -1) {
-        if (close(s->fd) < 0) {
+        if (closesocket(s->fd) < 0) {
             r = -errno;
         }
         s->fd = -1;
@@ -97,7 +97,7 @@  static void tcp_accept_incoming_migration(void *opaque)
         c = qemu_accept(s, (struct sockaddr *)&addr, &addrlen);
     } while (c == -1 && socket_error() == EINTR);
     qemu_set_fd_handler2(s, NULL, NULL, NULL, NULL);
-    close(s);
+    closesocket(s);
 
     DPRINTF("accepted migration\n");
 
@@ -115,7 +115,7 @@  static void tcp_accept_incoming_migration(void *opaque)
     process_incoming_migration(f);
     qemu_fclose(f);
 out:
-    close(c);
+    closesocket(c);
 }
 
 int tcp_start_incoming_migration(const char *host_port, Error **errp)