Bug 1488192 - libvirt-3.7.0/daemon/admin.c:449]: (style) Suspicious condition
Summary: libvirt-3.7.0/daemon/admin.c:449]: (style) Suspicious condition
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: ---
Assignee: Erik Skultety
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-09-04 15:49 UTC by David Binderman
Modified: 2017-09-05 10:41 UTC (History)
3 users (show)

Fixed In Version: libvirt-3.8.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-09-05 10:40:25 UTC
Embargoed:


Attachments (Terms of Use)

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>


Note You need to log in before you can comment on or make changes to this bug.