[FFmpeg-devel] [PATCH] ffmpeg: use isatty() before messing with the terminal state

Michael Niedermayer michaelni at gmx.at
Tue Jun 5 20:24:17 CEST 2012


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

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 ffmpeg.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index a897c9e..8d5c1af 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1369,7 +1369,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;
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list