Clear handler only for valid fd

Signed-off-by: Orit Wasserman <owasserm@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
Orit Wasserman 2012-09-24 13:11:10 +02:00 committed by Anthony Liguori
parent 233aa5c2d1
commit 3202becaa2
1 changed files with 3 additions and 1 deletions

View 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");