[PATCH 7/7] Simplify some conditions

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

 



In qemuMigrationSrcRun, we already checked for non-NULL mig
and then dereferenced it. It's only possible for mig to be
NULL in the error section.

In remoteConnectOpen, conn->uri cannot be NULL in the second
part of the OR expression due to short-circuit evaluation.

Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
 src/qemu/qemu_migration.c  | 2 +-
 src/remote/remote_driver.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index bf89e184e..e5231555d 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -3992,7 +3992,7 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver,
         goto error;
     }
 
-    if (mig && mig->nbd &&
+    if (mig->nbd &&
         qemuMigrationSrcCancelDriveMirror(driver, vm, true,
                                           QEMU_ASYNC_JOB_MIGRATION_OUT,
                                           dconn) < 0)
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 2ec69166f..9390bead6 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -1310,7 +1310,7 @@ remoteConnectOpen(virConnectPtr conn,
     int ret, rflags = 0;
     const char *autostart = virGetEnvBlockSUID("LIBVIRT_AUTOSTART");
 
-    if (inside_daemon && (!conn->uri || (conn->uri && !conn->uri->server)))
+    if (inside_daemon && (!conn->uri || !conn->uri->server))
         return VIR_DRV_OPEN_DECLINED;
 
     if (!(priv = remoteAllocPrivateData()))
-- 
2.16.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux