Clear handler only for valid fd
authorOrit Wasserman <owasserm@redhat.com>
Mon, 24 Sep 2012 11:11:10 +0000 (13:11 +0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Wed, 26 Sep 2012 00:05:56 +0000 (19:05 -0500)
Signed-off-by: Orit Wasserman <owasserm@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
migration.c

index 1edeec5..22a05c4 100644 (file)
@@ -240,7 +240,9 @@ static int migrate_fd_cleanup(MigrationState *s)
 {
     int ret = 0;
 
-    qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL);
+    if (s->fd != -1) {
+        qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL);
+    }
 
     if (s->file) {
         DPRINTF("closing file\n");