[PATCH 2/3] Fix issue where cli socket buffer may get full

Joakim Tjernlund Joakim.Tjernlund at infinera.com
Tue Jun 11 14:38:12 CEST 2019


On Tue, 2019-06-11 at 12:09 +0200, Kenth Eriksson wrote:

> 
> The cli module must reset the socket io buffer rpos when all characters
> in the socket buffer has been processed.
> 
> The method cli_get_command is always invoked twice for every CLI
> command, thus rxpos may also be reset at the second invocation if no
> newline was found and no new data is input to the socket buffer.
> 
> Signed-off-by: Kenth Eriksson <kenth.eriksson at infinera.com>
> ---
>  sysdep/unix/main.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/sysdep/unix/main.c b/sysdep/unix/main.c
> index 921115b1..cf5f4a3c 100644
> --- a/sysdep/unix/main.c
> +++ b/sysdep/unix/main.c
> @@ -403,7 +403,10 @@ cli_get_command(cli *c)
>         {
>           t++;
>           c->rx_pos = c->rx_buf;
> -         c->rx_aux = t;
> +          if (t < tend)
> +            c->rx_aux = t;
> +          else
> +            c->rx_aux = s->rpos = s->rbuf;

Nu går det att läsa :) Indent ser lite knas ut el. så är det Evolution som buggar

>           *d = 0;
>           return (d < dend) ? 1 : -1;
>         }
> --
> 2.21.0
> 




More information about the Bird-users mailing list