From nobody Thu Dec 26 21:37:52 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1707320539765536.5216465240215; Wed, 7 Feb 2024 07:42:19 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id AB4961D7E; Wed, 7 Feb 2024 10:42:18 -0500 (EST) Received: from lists.libvirt.org.85.43.8.in-addr.arpa (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id C70C91DAA; Wed, 7 Feb 2024 10:40:04 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 3CEE519D4; Wed, 7 Feb 2024 10:39:57 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id AD65419D5 for ; Wed, 7 Feb 2024 10:39:56 -0500 (EST) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-362-D_cwkjE4OUaaO53uYBfoxA-1; Wed, 07 Feb 2024 10:39:54 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 86C1B3C28645 for ; Wed, 7 Feb 2024 15:39:54 +0000 (UTC) Received: from maggie.brq.redhat.com (unknown [10.43.3.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2EF7B1C02EB3 for ; Wed, 7 Feb 2024 15:39:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: D_cwkjE4OUaaO53uYBfoxA-1 From: Michal Privoznik To: devel@lists.libvirt.org Subject: [PATCH 1/2] virsh-domain: Fix return of virshGetDBusDisplay() in one error path Date: Wed, 7 Feb 2024 16:39:50 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: 7LOLTOUQ6P7IX2KKWZFGNV7SD66AD74E X-Message-ID-Hash: 7LOLTOUQ6P7IX2KKWZFGNV7SD66AD74E X-MailFrom: mprivozn@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8"; x-default="true" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1707320540589100001 The virshGetDBusDisplay() function is declared to return a pointer and yet, in one error path false is returned. Switch the statement to return NULL, which is what other error paths use to indicate an error. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- tools/virsh-domain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 58d5a4ab57..e69d14a6aa 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -11908,7 +11908,7 @@ virshGetDBusDisplay(vshControl *ctl, xmlXPathContex= t *ctxt) =20 addr =3D virXPathString(xpath, ctxt); if (!addr) - return false; + return NULL; =20 if (STRPREFIX(addr, "unix:path=3D")) { return g_strdup_printf("dbus+unix://%s", addr + 10); --=20 2.43.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Thu Dec 26 21:37:52 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 170732060767167.0868680798485; Wed, 7 Feb 2024 07:43:27 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 92DD81DD1; Wed, 7 Feb 2024 10:43:26 -0500 (EST) Received: from lists.libvirt.org.85.43.8.in-addr.arpa (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 6BA211E37; Wed, 7 Feb 2024 10:40:15 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 99F9D19D4; Wed, 7 Feb 2024 10:39:57 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 0A14319D2 for ; Wed, 7 Feb 2024 10:39:57 -0500 (EST) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-528-0t95AsHKPz6JnXZVfFQEVA-1; Wed, 07 Feb 2024 10:39:55 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1F1021C0BB42 for ; Wed, 7 Feb 2024 15:39:55 +0000 (UTC) Received: from maggie.brq.redhat.com (unknown [10.43.3.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id BC1721C02EB3 for ; Wed, 7 Feb 2024 15:39:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: 0t95AsHKPz6JnXZVfFQEVA-1 From: Michal Privoznik To: devel@lists.libvirt.org Subject: [PATCH 2/2] examples: Define _GNU_SOURCE for more examples Date: Wed, 7 Feb 2024 16:39:51 +0100 Message-ID: <08ac24e98e88c1a390f37a8c385dc47ddb90a695.1707320373.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: N3TECSGEURHXAOC5KCI3JXH4XJJVX6QX X-Message-ID-Hash: N3TECSGEURHXAOC5KCI3JXH4XJJVX6QX X-MailFrom: mprivozn@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8"; x-default="true" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1707320608786100001 Some of our examples use GNU/Linux extensions functions/variables: 1) domtop.c uses usleep(3), 2) logging.c uses getopt(3). Put _GNU_SOURCE definition at the top of corresponding files so that users can just grab the code and compile it (in contrast with the rest of the code where _GNU_SOURCE is declared in meson-config.h). Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- examples/c/admin/logging.c | 1 + examples/c/domain/domtop.c | 1 + 2 files changed, 2 insertions(+) diff --git a/examples/c/admin/logging.c b/examples/c/admin/logging.c index 575d15a3a6..f7620b2ab5 100644 --- a/examples/c/admin/logging.c +++ b/examples/c/admin/logging.c @@ -1,3 +1,4 @@ +#define _GNU_SOURCE #include #include #include diff --git a/examples/c/domain/domtop.c b/examples/c/domain/domtop.c index 65663a1c39..2345a5953c 100644 --- a/examples/c/domain/domtop.c +++ b/examples/c/domain/domtop.c @@ -18,6 +18,7 @@ * . */ =20 +#define _GNU_SOURCE #include #include #include --=20 2.43.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org