[FFmpeg-cvslog] ffmpeg: avoid a confusing and easy to break if().

Reimar Döffinger git at videolan.org
Thu Jun 7 01:44:25 CEST 2012


ffmpeg | branch: release/0.11 | Reimar Döffinger <Reimar.Doeffinger at gmx.de> | Wed Jun  6 12:39:07 2012 +0200| [565581b0a4e89e2633bef868d9db52bd999122d0] | committer: Michael Niedermayer

ffmpeg: avoid a confusing and easy to break if().

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 93147daf59b096f3d6ad6d9e8d8c11c293e425d2)

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

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

 ffmpeg.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 99ecb78..6b204a1 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1456,10 +1456,11 @@ static void term_init(void)
 #if HAVE_TERMIOS_H
     if(!run_as_daemon){
         struct termios tty;
+        int istty = 1;
 #if HAVE_ISATTY
-        if(isatty(0) && isatty(2))
+        istty = isatty(0) && isatty(2);
 #endif
-        if (tcgetattr (0, &tty) == 0) {
+        if (istty && tcgetattr (0, &tty) == 0) {
             oldtty = tty;
             restore_tty = 1;
             atexit(term_exit);



More information about the ffmpeg-cvslog mailing list