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

Michael Niedermayer git at videolan.org
Thu Jun 7 01:44:25 CEST 2012


ffmpeg | branch: release/0.11 | Michael Niedermayer <michaelni at gmx.at> | Tue Jun  5 19:58:03 2012 +0200| [dc85ca0945c902695815fe9a32aeb383236a19b6] | 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>
(cherry picked from commit c8a11014b673ebc6946db6fcd20009d330c57c48)

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

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

diff --git a/ffmpeg.c b/ffmpeg.c
index fad21c0..99ecb78 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1456,7 +1456,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