Revision e53f27b9

b/monitor.c
2415 2415
        return -1;
2416 2416
    }
2417 2417

  
2418
    fd = dup(fd);
2419
    if (fd == -1) {
2420
        if (errno == EMFILE)
2421
            qerror_report(QERR_TOO_MANY_FILES);
2422
        else
2423
            qerror_report(QERR_UNDEFINED_ERROR);
2424
        return -1;
2425
    }
2426

  
2427 2418
    QLIST_FOREACH(monfd, &mon->fds, next) {
2428 2419
        if (strcmp(monfd->name, fdname) != 0) {
2429 2420
            continue;
b/qemu-char.c
2000 2000
static int tcp_get_msgfd(CharDriverState *chr)
2001 2001
{
2002 2002
    TCPCharDriver *s = chr->opaque;
2003

  
2004
    return s->msgfd;
2003
    int fd = s->msgfd;
2004
    s->msgfd = -1;
2005
    return fd;
2005 2006
}
2006 2007

  
2007 2008
#ifndef _WIN32
......
2089 2090
            tcp_chr_process_IAC_bytes(chr, s, buf, &size);
2090 2091
        if (size > 0)
2091 2092
            qemu_chr_read(chr, buf, size);
2092
        if (s->msgfd != -1) {
2093
            close(s->msgfd);
2094
            s->msgfd = -1;
2095
        }
2096 2093
    }
2097 2094
}
2098 2095

  

Also available in: Unified diff