Revision 27c3f2cb

b/vl.c
3283 3283

  
3284 3284
int main_loop(void *opaque)
3285 3285
{
3286
    struct pollfd ufds[2], *pf, *serial_ufd, *net_ufd, *gdb_ufd;
3287
    int ret, n, timeout;
3286
    struct pollfd ufds[3], *pf, *serial_ufd, *net_ufd, *gdb_ufd;
3287
    int ret, n, timeout, serial_ok;
3288 3288
    uint8_t ch;
3289 3289
    CPUState *env = global_env;
3290 3290

  
......
3296 3296
        term_init();
3297 3297
    }
3298 3298

  
3299
    serial_ok = 1;
3299 3300
    for(;;) {
3300 3301
        ret = cpu_x86_exec(env);
3301 3302
        if (reset_requested)
......
3310 3311
        /* poll any events */
3311 3312
        serial_ufd = NULL;
3312 3313
        pf = ufds;
3313
        if (!(serial_ports[0].lsr & UART_LSR_DR)) {
3314
        if (serial_ok && !(serial_ports[0].lsr & UART_LSR_DR)) {
3314 3315
            serial_ufd = pf;
3315 3316
            pf->fd = 0;
3316 3317
            pf->events = POLLIN;
......
3337 3338
                n = read(0, &ch, 1);
3338 3339
                if (n == 1) {
3339 3340
                    serial_received_byte(&serial_ports[0], ch);
3341
                } else {
3342
		    /* Closed, stop polling. */
3343
                    serial_ok = 0;
3340 3344
                }
3341 3345
            }
3342 3346
            if (net_ufd && (net_ufd->revents & POLLIN)) {

Also available in: Unified diff