[FFmpeg-devel] [PATCH] ffmpeg: use isatty() before messing with the terminal state
François Revol
revol at free.fr
Tue Jun 5 20:36:50 CEST 2012
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.
François.
More information about the ffmpeg-devel
mailing list