Revision 2d753894

b/qemu-char.c
1002 1002
           speed, parity, data_bits, stop_bits);
1003 1003
#endif
1004 1004
    tcgetattr (fd, &tty);
1005
    oldtty = tty;
1005 1006

  
1006 1007
#define check_speed(val) if (speed <= val) { spd = B##val; break; }
1007 1008
    speed = speed * 10 / 11;
......
1173 1174
    return 0;
1174 1175
}
1175 1176

  
1177
static void tty_exit(void)
1178
{
1179
    tcsetattr(0, TCSANOW, &oldtty);
1180
}
1181

  
1176 1182
static void qemu_chr_close_tty(CharDriverState *chr)
1177 1183
{
1178 1184
    FDCharDriver *s = chr->opaque;
......
1207 1213
    }
1208 1214
    chr->chr_ioctl = tty_serial_ioctl;
1209 1215
    chr->chr_close = qemu_chr_close_tty;
1216
    if (!term_atexit_done++)
1217
        atexit(tty_exit);
1210 1218
    return chr;
1211 1219
}
1212 1220
#else  /* ! __linux__ && ! __sun__ */

Also available in: Unified diff