[libvirt] [PATCH] Fix leftover typo '&' -> '&&'

Jiri Denemark jdenemar at redhat.com
Thu Oct 9 08:20:10 UTC 2014


On Thu, Oct 09, 2014 at 10:15:21 +0200, Martin Kletzander wrote:
> The actual origin of this so called typo are two commits.  The first one
> was commit 72f8a7f that came up with the following condition:
> 
> if ((i == 8) & (flags & VIR_QEMU_PROCESS_KILL_FORCE))
> 
> Fortunately this succeeded thanks to bool being (int)1 and
> VIR_QEMU_PROCESS_KILL_FORCE having the value of 1 << 0.  The check was
> then moved and altered in 8fd38231179c394f07d8a26bcbf3a0faa5eeaf24 to
> current state:
> 
> if ((i == 50) & force)
> 
> that will work again (both sides of '&' being booleans), but since this
> was missed so many times, it may pose a problem in the future in case it
> gets copy-pasted again.
> 
> Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
> ---
>  src/util/virprocess.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/util/virprocess.c b/src/util/virprocess.c
> index 486123a..6266cbe 100644
> --- a/src/util/virprocess.c
> +++ b/src/util/virprocess.c
> @@ -354,7 +354,7 @@ virProcessKillPainfully(pid_t pid, bool force)
>          int signum;
>          if (i == 0) {
>              signum = SIGTERM; /* kindly suggest it should exit */
> -        } else if ((i == 50) & force) {
> +        } else if ((i == 50) && force) {
>              VIR_DEBUG("Timed out waiting after SIGTERM to process %lld, "
>                        "sending SIGKILL", (long long)pid);
>              /* No SIGKILL kill on Win32 ! Use SIGABRT instead which our

While at it, you could have removed the extra () around i == 50 :-)

ACK

Jirka




More information about the libvir-list mailing list