Browse code

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>
(cherry picked from commit c8a11014b673ebc6946db6fcd20009d330c57c48)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2012/06/06 02:58:03
Showing 1 changed files
... ...
@@ -1456,7 +1456,9 @@ static void term_init(void)
1456 1456
 #if HAVE_TERMIOS_H
1457 1457
     if(!run_as_daemon){
1458 1458
         struct termios tty;
1459
-
1459
+#if HAVE_ISATTY
1460
+        if(isatty(0) && isatty(2))
1461
+#endif
1460 1462
         if (tcgetattr (0, &tty) == 0) {
1461 1463
             oldtty = tty;
1462 1464
             restore_tty = 1;