On Mon, Jan 14, 2013 at 9:16 PM, Florian Obser <[email protected]> wrote:

> this can be tested like this:
> EDITOR=mg cvs commit
> kill cvs
> -> mg spins with 100% cpu in ttgetc
>
> Might be related to what I saw a few times. When I detached screen or
tmux,
and go back, cpu would shoot to 100%.


> While there prevent an unterminated recursion in panic (via ttclose).
> I'm not particularly happy with the errorhandling in ttgetc, but this
> is the least intrusive change.
>
> comments, oks?
>
> diff --git ttyio.c ttyio.c
> index 228a370..5b9021f 100644
> --- ttyio.c
> +++ ttyio.c
> @@ -173,7 +173,9 @@ ttgetc(void)
>                                 redraw(0, 0);
>                                 winch_flag = 0;
>                         }
> -               } else if (ret == 1)
> +               } else if (ret == -1 && errno == EIO)
> +                       panic("lost stdin");
> +               else if (ret == 1)
>                         break;
>         } while (1);
>         return ((int) c) & 0xFF;
> @@ -196,6 +198,12 @@ charswaiting(void)
>  void
>  panic(char *s)
>  {
> +       static int panicking = 0;
> +
> +       if (panicking)
> +               return;
> +       else
> +               panicking = 1;
>         ttclose();
>         (void) fputs("panic: ", stderr);
>         (void) fputs(s, stderr);
>
> --
> I'm not entirely sure you are real.
>
>


-- 
Brightest day,
Blackest night,
No bug shall escape my sight,
And those who worship evil's mind,
be wary of my powers,
puffy lantern's light !

Reply via email to