]> git.sesse.net Git - ffmpeg/commitdiff
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 95f3e521b33d13b35e32535b6f006e3773ac9600..914bc6adb414293403f6e6e98f33720a6231eb6f 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;