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

Michael Niedermayer git at videolan.org
Wed Jun 6 05:33:29 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Jun  5 19:58:03 2012 +0200| [c8a11014b673ebc6946db6fcd20009d330c57c48] | committer: Michael Niedermayer

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 at free.fr>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c8a11014b673ebc6946db6fcd20009d330c57c48
---

 ffmpeg.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 95f3e52..914bc6a 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;



More information about the ffmpeg-cvslog mailing list