OSDN Git Service

failover: g_strcmp0() knows how to handle NULL
authorJuan Quintela <quintela@redhat.com>
Wed, 18 Nov 2020 08:37:30 +0000 (09:37 +0100)
committerMichael S. Tsirkin <mst@redhat.com>
Tue, 8 Dec 2020 18:48:57 +0000 (13:48 -0500)
Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-Id: <20201118083748.1328-10-quintela@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/net/virtio-net.c

index c221671..e334f05 100644 (file)
@@ -818,7 +818,7 @@ static int is_my_primary(void *opaque, QemuOpts *opts, Error **errp)
     int ret = 0;
     const char *standby_id = qemu_opt_get(opts, "failover_pair_id");
 
-    if (standby_id != NULL && (g_strcmp0(standby_id, n->netclient_name) == 0)) {
+    if (g_strcmp0(standby_id, n->netclient_name) == 0) {
         n->primary_device_id = g_strdup(opts->id);
         ret = 1;
     }