ffmpeg: use isatty() before messing with the terminal state
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 5 Jun 2012 17:58:03 +0000 (19:58 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 6 Jun 2012 01:54:02 +0000 (03:54 +0200)
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>
ffmpeg.c

index 95f3e52..914bc6a 100644 (file)
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1217,7 +1217,9 @@ static void term_init(void)
 #if HAVE_TERMIOS_H
     if(!run_as_daemon){
         struct termios tty;
-
+#if HAVE_ISATTY
+        if(isatty(0) && isatty(2))
+#endif
         if (tcgetattr (0, &tty) == 0) {
             oldtty = tty;
             restore_tty = 1;