Bug 1488192

Summary: libvirt-3.7.0/daemon/admin.c:449]: (style) Suspicious condition
Product: [Community] Virtualization Tools Reporter: David Binderman <dcb314>
Component: libvirtAssignee: Erik Skultety <eskultet>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: low Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: eskultet, libvirt-maint, rbalakri
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-3.8.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-09-05 10:40:25 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description David Binderman 2017-09-04 15:49:51 UTC
Description of problem:

libvirt-3.7.0/daemon/admin.c:449]: (style) Suspicious condition (assignment + comparison); Clarify expression with parentheses.

Source code is

    if ((noutputs = adminConnectGetLoggingOutputs(&outputs, args->flags) < 0)) {

Maybe better code

    if ((noutputs = adminConnectGetLoggingOutputs(&outputs, args->flags)) < 0) {

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Erik Skultety 2017-09-05 10:40:25 UTC
Fixed upstream by:

commit 4c248e938a5541768614b94ad2f8b946a301434c
Refs: v3.7.0-7-g4c248e938
Author:     Erik Skultety <eskultet>
AuthorDate: Tue Sep 5 10:06:33 2017 +0200
Commit:     Erik Skultety <eskultet>
CommitDate: Tue Sep 5 11:27:12 2017 +0200

    maint: Fix incorrect parenthesis placement causing true/false assignment

    There were a few places in our code where the following pattern in 'if'
    condition occurred:

    if ((foo = bar() < 0))
        do something;

    This patch adjusts the conditions to the expected format:

    if ((foo = bar()) < 0)
        do something;

    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1488192

    Signed-off-by: Erik Skultety <eskultet>
    Reviewed-by: Martin Kletzander <mkletzan>