[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] uml_driver: correct logic error in umlMonitorCommand



2010/7/13 Jim Meyering <jim meyering net>:
> The stray "< 0" removed by the fix below
> would have made umlMonitorCommand always fail
> with its "incomplete reply ..." diagnostic.
>
> >From 5f075332e33f7e9bf2d7979934b8dc7c3312b6e8 Mon Sep 17 00:00:00 2001
> From: Jim Meyering <meyering redhat com>
> Date: Tue, 13 Jul 2010 15:28:35 -0500
> Subject: [PATCH] uml_driver: correct logic error in umlMonitorCommand
>
> * src/uml/uml_driver.c (umlMonitorCommand): Correct flaw that would
> cause unconditional "incomplete reply ..." failure, since "nbytes"
> was always 0 or 1.
> ---
>  src/uml/uml_driver.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
> index 110179e..1e0f5ac 100644
> --- a/src/uml/uml_driver.c
> +++ b/src/uml/uml_driver.c
> @@ -730,7 +730,7 @@ static int umlMonitorCommand(const struct uml_driver *driver,
>         ssize_t nbytes;
>         addrlen = sizeof(addr);
>         nbytes = recvfrom(priv->monitor, &res, sizeof res, 0,
> -                          (struct sockaddr *)&addr, &addrlen) < 0;
> +                          (struct sockaddr *)&addr, &addrlen);
>         if (nbytes < 0) {
>             if (errno == EAGAIN || errno == EINTR)
>                 continue;
> --
> 1.7.1.460.gf3c4c
>

I wondered how the < 0 got there and git blame told me it's a leftover
from refactoring recvfrom out of 'if (nbytes < 0)'.

ACK.

Matthias


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]