On Fri, Aug 23, 2019 at 03:33:36PM +0200, Michal Privoznik wrote:
> Currently, whenever there's a regular EOF on the console stream
> or an error the virStreamAbort() is called regardless. While this
> may not actually break anything, we should call virStreamFinish()
> to let the daemon know we've successfully received all the data
> and are shutting down the stream gracefully.
> 
> Signed-off-by: Michal Privoznik <[email protected]>
> ---
>  tools/virsh-console.c | 41 +++++++++++++++++++++++++----------------
>  1 file changed, 25 insertions(+), 16 deletions(-)
> 
> diff --git a/tools/virsh-console.c b/tools/virsh-console.c
> index a235a9a283..900faa5087 100644
> --- a/tools/virsh-console.c
> +++ b/tools/virsh-console.c
> @@ -193,7 +202,7 @@ virConsoleEventOnStream(virStreamPtr st,
>          if (done == -2)
>              goto cleanup; /* blocking */
>          if (done < 0) {
> -            virConsoleShutdown(con);
> +            virConsoleShutdown(con, done == 0);
>              goto cleanup;
>          }
>          memmove(con->terminalToStream.data,

done is always non-zero here. If that's expected, a constant would be a
bit more cleaner here to sign explicit abort, rather than conditional.

Reviewed-by: Roman Bolshakov <[email protected]>

Thanks,
Roman

--
libvir-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to