[PATCH 3/3] logging: fix endless loop on EOF

Michal Prívozník mprivozn at redhat.com
Thu Oct 1 14:38:19 UTC 2020


On 9/24/20 3:24 PM, Nikolay Shirokovskiy wrote:
> On EOF condition we always have POLLHUP event and read returns
> 0 thus we never break loop in virLogHandlerDomainLogFileDrain.
> 
> Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy at virtuozzo.com>
> ---
>   src/logging/log_handler.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/src/logging/log_handler.c b/src/logging/log_handler.c
> index c04f341..152ca24 100644
> --- a/src/logging/log_handler.c
> +++ b/src/logging/log_handler.c
> @@ -464,6 +464,8 @@ virLogHandlerDomainLogFileDrain(virLogHandlerLogFilePtr file)
>               if (errno == EINTR)
>                   continue;
>               return;
> +        } else if (len == 0) {

Shouldn't we move "file->drained = true;" from above (not seen in the 
context though) into this branch and possibly the "if (len < 0)" branch? 
I mean, if we haven't read all the data the pipe is not drained, is it?

But let's do that in a separate patch anyway.

For 2/3 and 3/3:

Reviewed-by: Michal Privoznik <mprivozn at redhat.com>

Michal




More information about the libvir-list mailing list