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

Michael Niedermayer michaelni at gmx.at
Wed Jun 6 03:55:07 CEST 2012


On Tue, Jun 05, 2012 at 08:36:50PM +0200, François Revol wrote:
> On 05/06/2012 20:24, Michael Niedermayer wrote:
> > 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;
> 
> indentation seems odd but on the principle this looks ok to me.

dunno what i could do about the indention, reindenting the code
after the #if#else would look odd too i think, so ill leave the
indention for now

applied

thanks


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No human being will ever know the Truth, for even if they happen to say it
by chance, they would not even known they had done so. -- Xenophanes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120606/13d8fbdb/attachment.asc>


More information about the ffmpeg-devel mailing list