static int tcp_set_msgfds(CharDriverState *chr, int *fds, int num)

{

    TCPCharDriver *s = chr->opaque;



    /* clear old pending fd array */

    g_free(s->write_msgfds);



    if (num) {

        s->write_msgfds = g_malloc(num * sizeof(int));

        memcpy(s->write_msgfds, fds, num * sizeof(int));

    }



    s->write_msgfds_num = num;



    return 0;

}

static int tcp_set_msgfds(CharDriverState *chr, int *fds, int num)

{

    TCPCharDriver *s = chr->opaque;



    

    g_free(s->write_msgfds);



    if (num) {

        s->write_msgfds = g_malloc(num * sizeof(int));

        memcpy(s->write_msgfds, fds, num * sizeof(int));

    }



    s->write_msgfds_num = num;



    return 0;

}

        s->write_msgfds = g_malloc(num * sizeof(int));
static int FUNC_0(CharDriverState *VAR_0, int *VAR_1, int VAR_2)

{

    TCPCharDriver *s = VAR_0->opaque;



    

    g_free(s->write_msgfds);



    if (VAR_2) {

        s->write_msgfds = g_malloc(VAR_2 * sizeof(int));

        memcpy(s->write_msgfds, VAR_1, VAR_2 * sizeof(int));

    }



    s->write_msgfds_num = VAR_2;



    return 0;

}

static int FUNC_0(CharDriverState *VAR_0, int *VAR_1, int VAR_2)
{ TCPCharDriver *s = VAR_0->opaque; g_free(s->write_msgfds); if (VAR_2) { s->write_msgfds = g_malloc(VAR_2 * sizeof(int)); memcpy(s->write_msgfds, VAR_1, VAR_2 * sizeof(int)); } s->write_msgfds_num = VAR_2; return 0; }