From c8a11014b673ebc6946db6fcd20009d330c57c48 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 5 Jun 2012 19:58:03 +0200 Subject: [PATCH] ffmpeg: use isatty() before messing with the terminal state MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes terminal messup in case of crashes (like in make fate) Reviewed-by: François Revol Signed-off-by: Michael Niedermayer --- ffmpeg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ffmpeg.c b/ffmpeg.c index 95f3e521b3..914bc6adb4 100644 --- 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;