From nobody Wed May 15 09:20:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1586168411; cv=none; d=zohomail.com; s=zohoarc; b=Lb3h49TkPntw83FDAuWeAG3SkH7kPJTM5MZKAuMG8IwMTlVZY/KwGEIoXiu8AqNfLAf1X2SXZuy2Xx77UvuDliDU/hq1ajZp1F52GML/OY0cESD/07T0/ZPozuzyijd9CPv04rwABWQp7N0fYQUzgMQsSdtc/xBthBECPlmE2qI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586168411; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:Sender:Subject:To; bh=FFFqc3/NK2pF4/2RIEK4+UzgsaQkOpiB5W0YRBAQwQk=; b=nuxhvA9UzWk656DW97fc24vN3V7szEiHo2Ehx963E091wBx6pDwl1mrihoB87J6oB6UOS6jGKEhy9n0gDJQk0EbEbRNnOQKDj5I6NygRoqQlB4f+dHIAimzKSLWAO1DJmjevh5vXfquRyLBHiij7b8ZJpvPZgulBIWH+RL4td6g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1586168411201591.3027068061414; Mon, 6 Apr 2020 03:20:11 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-5-pfUcHM7oNh6F-N5r308X0w-1; Mon, 06 Apr 2020 06:20:08 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7AA6718B6398; Mon, 6 Apr 2020 10:20:02 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A94AC119581; Mon, 6 Apr 2020 10:20:01 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id AEFA093A69; Mon, 6 Apr 2020 10:19:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 036AJvKh004201 for ; Mon, 6 Apr 2020 06:19:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id C6D0B76ED; Mon, 6 Apr 2020 10:19:57 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C2C67518B for ; Mon, 6 Apr 2020 10:19:55 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D9E688FF66C for ; Mon, 6 Apr 2020 10:19:55 +0000 (UTC) Received: from mail-pj1-f67.google.com (mail-pj1-f67.google.com [209.85.216.67]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-489-W3KeRoZ4MQuXGHK-nGSHKA-1; Mon, 06 Apr 2020 06:19:51 -0400 Received: by mail-pj1-f67.google.com with SMTP id l36so6297044pjb.3; Mon, 06 Apr 2020 03:19:50 -0700 (PDT) Received: from localhost.localdomain ([49.34.46.12]) by smtp.gmail.com with ESMTPSA id h71sm10444715pge.32.2020.04.06.03.19.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Apr 2020 03:19:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586168410; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=FFFqc3/NK2pF4/2RIEK4+UzgsaQkOpiB5W0YRBAQwQk=; b=jAVHGJyZrzhT1Bphdgrr9uyF7XDoLqhCDHw701oXVE8DrvRGC40PXAwKWIVaWzezDpgAvr bLELrRSNNN4LCCD8Fiuu1J9YP9Wu8K9FWHH9l/sH6rxTp5m1QD8GPlyfit2kabgorqOvJx Vm3KH4rP0LwOtqlpEqaHRtzihcqGrJA= X-MC-Unique: pfUcHM7oNh6F-N5r308X0w-1 X-MC-Unique: W3KeRoZ4MQuXGHK-nGSHKA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=tTrkey2O0YNVsZl7nUNZQwuYgTuFWCGUMNSfNxGZCUM=; b=L+UhlM85E8+zNQMgfcE/KZyfL4dCMNOi7lqijmu9ua/5Web/p36nYxMTx5N1OlzDAw XbPN+KR+RdrZ1s80uVATlUtE2tjBIviA51iE9xzJ+uUAi3KOCBoigunbhY1xWaSF9n6M u1VpXxY3gYKkAsUnTRS/4HSIO3HFyXQl7rSlzfYtXXz8T02hjfCzp4z4RaSS9YgVY9C/ ig+AENiQ+zEzhGXh3gEDi/xVCmHC9ipvjStkqvGoDQ+RLn4Jzw5dmGWCfAzCLuij0Q/j jNNlNSu5UUTN23AL3IYEcexZpCpSyBTlB7HkXZyTc4p8gzZH6VGmmtE7i0hkqxfIpPn+ iDiA== X-Gm-Message-State: AGi0PuaB0cmT/Ta7AKd+b1p3/zJ0sH5MWhcd7+yMmvL3HSBeC6FF9ePR lsuq8TML3dFhEY7QzmEc4p/+TlLb X-Google-Smtp-Source: APiQypKRt3eFjrfXpRpsdMGsXrsMs7UHbgEU5FGsqXxYPOv212hg3VfuVhooLSr1kSlDF+BzQDQMGw== X-Received: by 2002:a17:90a:feb:: with SMTP id 98mr25825416pjz.72.1586168389544; Mon, 06 Apr 2020 03:19:49 -0700 (PDT) From: Mishal Shah To: libvir-list@redhat.com Subject: [libvirt PATCH] fix build by NULL string handling Date: Mon, 6 Apr 2020 15:49:36 +0530 Message-Id: <20200406101936.31423-1-shahmishal1998@gmail.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 036AJvKh004201 X-loop: libvir-list@redhat.com Cc: mprivozn@redhat.com, Mishal Shah X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 2 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Fix libvirt build by taking care of NULL string handling --- src/openvz/openvz_driver.c | 6 +++++- tests/sockettest.c | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c index 1a189dbbe7..46f117cd00 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c @@ -2084,7 +2084,7 @@ openvzDomainMigratePrepare3Params(virConnectPtr dconn, virDomainDefPtr def =3D NULL; virDomainObjPtr vm =3D NULL; char *my_hostname =3D NULL; - const char *hostname =3D NULL; + char *hostname =3D NULL; virURIPtr uri =3D NULL; int ret =3D -1; =20 @@ -2149,6 +2149,10 @@ openvzDomainMigratePrepare3Params(virConnectPtr dcon= n, } } =20 + if (hostname =3D=3D NULL) { + goto error; + } + *uri_out =3D g_strdup_printf("ssh://%s", hostname); =20 ret =3D 0; diff --git a/tests/sockettest.c b/tests/sockettest.c index 29a565de40..f0a0815b88 100644 --- a/tests/sockettest.c +++ b/tests/sockettest.c @@ -188,8 +188,12 @@ static int testMaskNetwork(const char *addrstr, return -1; =20 if (STRNEQ(networkstr, gotnet)) { - VIR_FREE(gotnet); - fprintf(stderr, "Expected %s, got %s\n", networkstr, gotnet); + if (gotnet =3D=3D NULL) { + fprintf(stderr, "Expected %s, got empty string\n", networkstr); + } else { + fprintf(stderr, "Expected %s, got %s\n", networkstr, gotnet); + VIR_FREE(gotnet); + } return -1; } VIR_FREE(gotnet); --=20 2.17.1