ffmpeg: use isatty() before messing with the terminal state

This fixes terminal messup in case of crashes (like in make fate)

Reviewed-by: François Revol <revol@free.fr>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
pull/59/head
Michael Niedermayer 13 years ago
parent ad60b3b181
commit c8a11014b6
  1. 4
      ffmpeg.c

@ -1217,7 +1217,9 @@ static void term_init(void)
#if HAVE_TERMIOS_H #if HAVE_TERMIOS_H
if(!run_as_daemon){ if(!run_as_daemon){
struct termios tty; struct termios tty;
#if HAVE_ISATTY
if(isatty(0) && isatty(2))
#endif
if (tcgetattr (0, &tty) == 0) { if (tcgetattr (0, &tty) == 0) {
oldtty = tty; oldtty = tty;
restore_tty = 1; restore_tty = 1;

Loading…
Cancel
Save