static int migrate_fd_cleanup(MigrationState *s)

{

    int ret = 0;



    qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL);



    if (s->file) {

        DPRINTF("closing file\n");

        if (qemu_fclose(s->file) != 0) {

            ret = -1;

        }

        s->file = NULL;

    } else {

        if (s->mon) {

            monitor_resume(s->mon);

        }

    }



    if (s->fd != -1) {

        close(s->fd);

        s->fd = -1;

    }



    return ret;

}

static int migrate_fd_cleanup(MigrationState *s)

{

    int ret = 0;



    qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL);



    if (s->file) {

        DPRINTF("closing file\n");

        if (qemu_fclose(s->file) != 0) {

            ret = -1;

        }

        s->file = NULL;

    } else {

        if (s->mon) {

            monitor_resume(s->mon);

        }

    }



    if (s->fd != -1) {

        close(s->fd);

        s->fd = -1;

    }



    return ret;

}

static int FUNC_0(MigrationState *VAR_0)

{

    int VAR_1 = 0;



    qemu_set_fd_handler2(VAR_0->fd, NULL, NULL, NULL, NULL);



    if (VAR_0->file) {

        DPRINTF("closing file\n");

        if (qemu_fclose(VAR_0->file) != 0) {

            VAR_1 = -1;

        }

        VAR_0->file = NULL;

    } else {

        if (VAR_0->mon) {

            monitor_resume(VAR_0->mon);

        }

    }



    if (VAR_0->fd != -1) {

        close(VAR_0->fd);

        VAR_0->fd = -1;

    }



    return VAR_1;

}

static int FUNC_0(MigrationState *VAR_0)
{ int VAR_1 = 0; qemu_set_fd_handler2(VAR_0->fd, NULL, NULL, NULL, NULL); if (VAR_0->file) { DPRINTF("closing file\n"); if (qemu_fclose(VAR_0->file) != 0) { VAR_1 = -1; } VAR_0->file = NULL; } else { if (VAR_0->mon) { monitor_resume(VAR_0->mon); } } if (VAR_0->fd != -1) { close(VAR_0->fd); VAR_0->fd = -1; } return VAR_1; }