From nobody Mon May 6 14:19:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1639421978; cv=none; d=zohomail.com; s=zohoarc; b=ioCJClXxb/N1zvaGQDUohUSg1mQG/FPc568bGHr00FmsH7pcvYe14Itw8lv/lhtCUUgsxVrVpFN6KIURpUdV52uP8TjvbxGVuS73vEaovs1ut4nPVWkV9TOgd+YN1PefIcZTIEFHYUc8PzQHMR7MDQ/gp+J2mxNWzxQKQFpOBy0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639421978; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=B/HjmtN3ppZI3memb6PJek7O/2XVfffpLyKAIzQlI1o=; b=PsNfX8i/M5ynrID7vIxRJ3eF34G0kL0EGXddRvEWYoWwFyq15G8BPWTFplHKi/r90Be8f0fbbRcPGl58H5V5FvwUwynoVOeqeojM3fGcYCtmysL/+JIV+asii4ImKGWLzlYNyzIAMbIotk/g7P2m+ELtHaWTvD5XeZjVNAUK/9k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1639421978301582.5219702166977; Mon, 13 Dec 2021 10:59:38 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-307-XT9Aqj-UP3KaUJbt08lzRw-1; Mon, 13 Dec 2021 13:59:34 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5BC9E93921; Mon, 13 Dec 2021 18:59:23 +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 3C05C5BE02; Mon, 13 Dec 2021 18:59:23 +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 0D5A14A705; Mon, 13 Dec 2021 18:59:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BDIxC34006829 for ; Mon, 13 Dec 2021 13:59:12 -0500 Received: by smtp.corp.redhat.com (Postfix) id 65A24ADCB; Mon, 13 Dec 2021 18:59:12 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id E130A5DF4B for ; Mon, 13 Dec 2021 18:59:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639421977; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=B/HjmtN3ppZI3memb6PJek7O/2XVfffpLyKAIzQlI1o=; b=EG7g9NndeO9ZDei2PWL0V+xEQepXHXILwTmYS9LzUo5LQHhsPiUigSNdd/oyJEOsUXgu9C XaChjRv0uQru/GVed14oCdqfVwLUfIKQ86h9wDeKMSdmCet6d1qjxN/MzTNJlWRVDgXreq UeMP+bnjvsgeaFVCZCJpTO430gAJh0g= X-MC-Unique: XT9Aqj-UP3KaUJbt08lzRw-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 1/5] docs: use g_auto in virCommand example Date: Mon, 13 Dec 2021 19:58:46 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639421979649100001 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- docs/internals/command.html.in | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/docs/internals/command.html.in b/docs/internals/command.html.in index 585ba53a93..d9f53933c6 100644 --- a/docs/internals/command.html.in +++ b/docs/internals/command.html.in @@ -564,14 +564,12 @@ int runhook(const char *drvstr, const char *id, const char *opstr, const char *subopstr, const char *extra) { - int ret; - char *path; - virCommand *cmd; + g_autofree char *path =3D NULL; + g_autoptr(virCommand) cmd =3D NULL; =20 virBuildPath(&path, LIBVIRT_HOOK_DIR, drvstr); =20 cmd =3D virCommandNew(path); - VIR_FREE(path); =20 virCommandAddEnvPassCommon(cmd); =20 @@ -579,11 +577,7 @@ int runhook(const char *drvstr, const char *id, =20 virCommandSetInputBuffer(cmd, input); =20 - ret =3D virCommandRun(cmd, NULL); - - virCommandFree(cmd); - - return ret; + return virCommandRun(cmd, NULL); } =20 --=20 2.31.1 From nobody Mon May 6 14:19:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1639421979; cv=none; d=zohomail.com; s=zohoarc; b=ZBWW3KWGkAKKYDP/Z8Ogms8FWQLZEplk0BnavrHdznrZ7mG4ucPwIsItYxW7mCpdsWdd35490LB0GChGsQWfnz2Iid8fdcRC2I8NW3CoJzmnfx243aybz1SBjgtPAg1vqSuD5OXiVmynnpXRiOU/OO1gX9xk8+Lxz0nxoZlTYiA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639421979; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=gsKYWCL7xwqBL6GxmEVB/jIk1XnmLca6JOlFKlw3n64=; b=WVozqUUoOaMmNlgoIDyyH33ZXRrpNHE2sKqgnAHL3E632aupqglN8FDwj6TMnr6gzz5ax1pDr+0BfKxlBmh5J9PXyHAb8ViqgvizK1mxVnF0153Q/l3FYdplsiVo1GirQjGTBTu8vAAyNAuqohH3Grqh7mTMNoy+JfpUIm76ntI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1639421979341751.9062435070203; Mon, 13 Dec 2021 10:59:39 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-552-uVDmve6COrO1_qHkzJVbEg-1; Mon, 13 Dec 2021 13:59:34 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 47807102C87E; Mon, 13 Dec 2021 18:59:26 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D823C5F4EA; Mon, 13 Dec 2021 18:59:25 +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 A66C61809CB8; Mon, 13 Dec 2021 18:59:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BDIxE4E006839 for ; Mon, 13 Dec 2021 13:59:14 -0500 Received: by smtp.corp.redhat.com (Postfix) id 87B4DADCB; Mon, 13 Dec 2021 18:59:14 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0F5E65E272 for ; Mon, 13 Dec 2021 18:59:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639421978; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=gsKYWCL7xwqBL6GxmEVB/jIk1XnmLca6JOlFKlw3n64=; b=GgwiAFTI2vZmZcJQlz6ykD2kAfS50HjlRhlekIU5Dibi1Jgx1AFhsuixb/tbURZzGo1h7v xKbcFJeA5mV+8d5rgsHa2j0xWbPJ9SrcDzTlO0T9o3rZi5UqYfMSQPqdF1ZP4EMxKZZRnT HELqMo+UK49WiPTErJdnc6VPc67jKeg= X-MC-Unique: uVDmve6COrO1_qHkzJVbEg-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 2/5] util: dnsmasq: refactor CapsRefresh Date: Mon, 13 Dec 2021 19:58:47 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639421980126100003 Use two variables with automatic cleanup instead of reusing one. Remove the pointless cleanup label. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/util/virdnsmasq.c | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/src/util/virdnsmasq.c b/src/util/virdnsmasq.c index 2dd9a20377..b62e353ceb 100644 --- a/src/util/virdnsmasq.c +++ b/src/util/virdnsmasq.c @@ -666,9 +666,9 @@ dnsmasqCapsSetFromBuffer(dnsmasqCaps *caps, const char = *buf) static int dnsmasqCapsRefreshInternal(dnsmasqCaps *caps, bool force) { - int ret =3D -1; struct stat sb; - virCommand *cmd =3D NULL; + g_autoptr(virCommand) vercmd =3D NULL; + g_autoptr(virCommand) helpcmd =3D NULL; g_autofree char *help =3D NULL; g_autofree char *version =3D NULL; g_autofree char *complete =3D NULL; @@ -692,31 +692,26 @@ dnsmasqCapsRefreshInternal(dnsmasqCaps *caps, bool fo= rce) if (!virFileIsExecutable(caps->binaryPath)) { virReportSystemError(errno, _("dnsmasq binary %s is not executable= "), caps->binaryPath); - goto cleanup; + return -1; } =20 - cmd =3D virCommandNewArgList(caps->binaryPath, "--version", NULL); - virCommandSetOutputBuffer(cmd, &version); - virCommandAddEnvPassCommon(cmd); - virCommandClearCaps(cmd); - if (virCommandRun(cmd, NULL) < 0) - goto cleanup; - virCommandFree(cmd); + vercmd =3D virCommandNewArgList(caps->binaryPath, "--version", NULL); + virCommandSetOutputBuffer(vercmd, &version); + virCommandAddEnvPassCommon(vercmd); + virCommandClearCaps(vercmd); + if (virCommandRun(vercmd, NULL) < 0) + return -1; =20 - cmd =3D virCommandNewArgList(caps->binaryPath, "--help", NULL); - virCommandSetOutputBuffer(cmd, &help); - virCommandAddEnvPassCommon(cmd); - virCommandClearCaps(cmd); - if (virCommandRun(cmd, NULL) < 0) - goto cleanup; + helpcmd =3D virCommandNewArgList(caps->binaryPath, "--help", NULL); + virCommandSetOutputBuffer(helpcmd, &help); + virCommandAddEnvPassCommon(helpcmd); + virCommandClearCaps(helpcmd); + if (virCommandRun(helpcmd, NULL) < 0) + return -1; =20 complete =3D g_strdup_printf("%s\n%s", version, help); =20 - ret =3D dnsmasqCapsSetFromBuffer(caps, complete); - - cleanup: - virCommandFree(cmd); - return ret; + return dnsmasqCapsSetFromBuffer(caps, complete); } =20 static dnsmasqCaps * --=20 2.31.1 From nobody Mon May 6 14:19:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1639421966; cv=none; d=zohomail.com; s=zohoarc; b=jvjNKvqwvDO6rk/I16AkWF0Kw7GXowdWTpwylNfcD5jP7c8AB1DiN7Qhm1XIuN+OxpNwcuocJBhwMcQV55v6q5HLyDpzCUZrPPw1IYyD5d5vX/N9kyHw62bXCJHrNzBkip6t4bl1HHz0rNhZEeFKCeMklaOr4k+7Wnz1Lp27xUs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639421966; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=KMQgX4eCBFfuEpyGg8O4S8MV4Q9bT0FVQVpuKd+41eU=; b=MMltYI008vWjZy9POhBvqqGxEJbIfk8GNJjbitkXHfgvQjrqmR3ZV+YhYscvRH2Hk9bSVgleuqgXo7VeMfgOcJL/sDTReu6DtPGTcXSHwk2EHBHQfgujJgMWCBC0Q7AYLsGYoVTRmh7x4r51hqdS+PYCSCA6T4LEYBYAmAQR8QY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1639421966746364.78240066619185; Mon, 13 Dec 2021 10:59:26 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-336-KT-qKdF2NyWzyQxNxy8PIg-1; Mon, 13 Dec 2021 13:59:24 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7D3A181CCBE; Mon, 13 Dec 2021 18:59:19 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 15A9E6A8EC; Mon, 13 Dec 2021 18:59:19 +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 D6BD31809CB8; Mon, 13 Dec 2021 18:59:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BDIxFBW006844 for ; Mon, 13 Dec 2021 13:59:15 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5A70D5E26C; Mon, 13 Dec 2021 18:59:15 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id D6175ADCB for ; Mon, 13 Dec 2021 18:59:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639421965; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=KMQgX4eCBFfuEpyGg8O4S8MV4Q9bT0FVQVpuKd+41eU=; b=WLT3lG11jWoRVDW9spcgkfZZGnG3poirD/2DIDx53/BeF9poPz810ZzCnQp8SGQvePxq+u /E9/X6GYZVpDfdQ8Wxr9VK8Jo9tsHm0LuyF4ZvhHSWK8niZ8sw7qm/vxXlEPZ2W761O9G7 RGINti4ZqYy1si6Zf3UYba4mHmtzsBo= X-MC-Unique: KT-qKdF2NyWzyQxNxy8PIg-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 3/5] util: iscsi: use two vars in CreateIfaceIQN Date: Mon, 13 Dec 2021 19:58:48 +0100 Message-Id: <09ff592adf40044053d862d9c2e6680e5e4a7110.1639421880.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639421967666100003 Do not mix automatic and manual cleanup. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/util/viriscsi.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/util/viriscsi.c b/src/util/viriscsi.c index ab4363a5ab..e84d49b03c 100644 --- a/src/util/viriscsi.c +++ b/src/util/viriscsi.c @@ -208,7 +208,8 @@ virStorageBackendCreateIfaceIQN(const char *initiatoriq= n, int exitstatus =3D -1; g_autofree char *iface_name =3D NULL; g_autofree char *temp_ifacename =3D NULL; - g_autoptr(virCommand) cmd =3D NULL; + g_autoptr(virCommand) newcmd =3D NULL; + g_autoptr(virCommand) updatecmd =3D NULL; =20 temp_ifacename =3D g_strdup_printf("libvirt-iface-%08llx", (unsigned long long)virRandomBits(32)= ); @@ -216,35 +217,34 @@ virStorageBackendCreateIfaceIQN(const char *initiator= iqn, VIR_DEBUG("Attempting to create interface '%s' with IQN '%s'", temp_ifacename, initiatoriqn); =20 - cmd =3D virCommandNewArgList(ISCSIADM, - "--mode", "iface", - "--interface", temp_ifacename, - "--op", "new", - NULL); + newcmd =3D virCommandNewArgList(ISCSIADM, + "--mode", "iface", + "--interface", temp_ifacename, + "--op", "new", + NULL); /* Note that we ignore the exitstatus. Older versions of iscsiadm * tools returned an exit status of > 0, even if they succeeded. * We will just rely on whether the interface got created * properly. */ - if (virCommandRun(cmd, &exitstatus) < 0) { + if (virCommandRun(newcmd, &exitstatus) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Failed to run command '%s' to create new iscsi i= nterface"), ISCSIADM); return -1; } - virCommandFree(cmd); =20 - cmd =3D virCommandNewArgList(ISCSIADM, - "--mode", "iface", - "--interface", temp_ifacename, - "--op", "update", - "--name", "iface.initiatorname", - "--value", - initiatoriqn, - NULL); + updatecmd =3D virCommandNewArgList(ISCSIADM, + "--mode", "iface", + "--interface", temp_ifacename, + "--op", "update", + "--name", "iface.initiatorname", + "--value", + initiatoriqn, + NULL); /* Note that we ignore the exitstatus. Older versions of iscsiadm too= ls * returned an exit status of > 0, even if they succeeded. We will ju= st * rely on whether iface file got updated properly. */ - if (virCommandRun(cmd, &exitstatus) < 0) { + if (virCommandRun(updatecmd, &exitstatus) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Failed to run command '%s' to update iscsi inter= face with IQN '%s'"), ISCSIADM, initiatoriqn); --=20 2.31.1 From nobody Mon May 6 14:19:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.151.124 as permitted sender) client-ip=170.10.151.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.151.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1639421979; cv=none; d=zohomail.com; s=zohoarc; b=HCYi8pYxL5AKqhg091eBI8pSsW5BWsL7QUNWu3ZGnjy8/nK5uTOlnZmVt2xR8D64ZVtmGEDdl0uf16xAFsLXDtYa8r7+W6HatdZBPDYwYCVbPsbtSgxfyRHct25Vc3CIkYlS7Rmu9rXnH59kcvJRKOg53PjgReqHo0vjy8BuldU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639421979; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=OWiL4PmEWAnmm1dpSksjFnUCOvPYqkre+FxnZZonYig=; b=ZCx92ndOYMjELQoYIIHkNfpe25sQuOGHyVld1nevZFJagMi4qaAyRvyKoFOrCHuUy0x2/jzR4tBRtF93n5j8BWzB9REnoRSmKcBFkZGM/BVQ2OOGTP6GyybxzfOgO45NqXDtz40ic+xGYMWpRrPhmIaewPEG8ljzawdcY4QI6E8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.151.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.151.124]) by mx.zohomail.com with SMTPS id 1639421979336206.3935733654871; Mon, 13 Dec 2021 10:59:39 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-2-SQnL3B1oO7qghWoHhKv1Lg-1; Mon, 13 Dec 2021 13:59:33 -0500 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 B739A802928; Mon, 13 Dec 2021 18:59:28 +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 9C48445D8A; Mon, 13 Dec 2021 18:59:28 +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 70B9A4A706; Mon, 13 Dec 2021 18:59:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BDIxGnJ006852 for ; Mon, 13 Dec 2021 13:59:16 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2C1735DF3A; Mon, 13 Dec 2021 18:59:16 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id A82B3ADCB for ; Mon, 13 Dec 2021 18:59:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639421977; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=OWiL4PmEWAnmm1dpSksjFnUCOvPYqkre+FxnZZonYig=; b=UMB83qOqC/MZeCbPuKbdXlR9ptJQtAr8A5zQk/bLhKA6JZPUuq6Kg/EwEBoVt7SYQjFjSX NRdwHq4g9dmj2jkoBE0VoqZqUMxWrzXBlsif0G6eSHqPEy/FilVi2ot2ASMa72AAKQicHU X56OK+PHKZNG24kXWx93NGCbg9gAqmM= X-MC-Unique: SQnL3B1oO7qghWoHhKv1Lg-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 4/5] util: refactor virNodeSuspendSetNodeWakeup Date: Mon, 13 Dec 2021 19:58:49 +0100 Message-Id: <210f84c5aae6fc88741c445ba58cee4ecdc83f0d.1639421880.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639421980293100004 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/util/virnodesuspend.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/util/virnodesuspend.c b/src/util/virnodesuspend.c index 451d798363..c92232dfe9 100644 --- a/src/util/virnodesuspend.c +++ b/src/util/virnodesuspend.c @@ -73,8 +73,7 @@ static void virNodeSuspendUnlock(void) */ static int virNodeSuspendSetNodeWakeup(unsigned long long alarmTime) { - virCommand *setAlarmCmd; - int ret =3D -1; + g_autoptr(virCommand) setAlarmCmd =3D NULL; =20 if (alarmTime < MIN_TIME_REQ_FOR_SUSPEND) { virReportError(VIR_ERR_INVALID_ARG, @@ -86,14 +85,7 @@ static int virNodeSuspendSetNodeWakeup(unsigned long lon= g alarmTime) setAlarmCmd =3D virCommandNewArgList("rtcwake", "-m", "no", "-s", NULL= ); virCommandAddArgFormat(setAlarmCmd, "%lld", alarmTime); =20 - if (virCommandRun(setAlarmCmd, NULL) < 0) - goto cleanup; - - ret =3D 0; - - cleanup: - virCommandFree(setAlarmCmd); - return ret; + return virCommandRun(setAlarmCmd, NULL); } =20 /** --=20 2.31.1 From nobody Mon May 6 14:19:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1639421966; cv=none; d=zohomail.com; s=zohoarc; b=LMHpAba4k0py0WrmXu6eyCXdiRYu/NEYiK0fJI8LrHcwRYY7vYYBDDy1EH44vULc2ssCgK7Dk0kDaIjUrkrbrSdptrB+SP/M088Gr48n9cgKhxSc8sz7n9JbRFGrhq5m+5fDqIIKwNKhpBrrpTh4OdbLTxiRMmzflMJx4i7JceA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639421966; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=6bBY++ZykjHBbAarcsA1j9LMug5l+vr/ZQ/AjGPzkvg=; b=WCECErJMsMSVXlryzhITtUdQOY1fi1XLtclrrPCYcQoXzEVuRj2sJHtokYJzcr545T34bMJ+nKMU7TC/e2vmOP0FCRnSPIOQgZHRqujO33mak9y9dKvr3aFUzOJGx5H0XUryS7NORW80DsXeaA77HAa4aMAuO0KCrmktBlR5dN8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1639421966231561.5385100208343; Mon, 13 Dec 2021 10:59:26 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-480-HAinFh8RMGu84bg0FrpKlw-1; Mon, 13 Dec 2021 13:59:23 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D76F093925; Mon, 13 Dec 2021 18:59:18 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B6D9878342; Mon, 13 Dec 2021 18:59:18 +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 7A4E21809CB8; Mon, 13 Dec 2021 18:59:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BDIxGWQ006867 for ; Mon, 13 Dec 2021 13:59:17 -0500 Received: by smtp.corp.redhat.com (Postfix) id F20D45DF3A; Mon, 13 Dec 2021 18:59:16 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 79E715E26C for ; Mon, 13 Dec 2021 18:59:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639421965; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=6bBY++ZykjHBbAarcsA1j9LMug5l+vr/ZQ/AjGPzkvg=; b=YyUhaBpxIxeBfEX2ZX3RVBx58H0HlA7P1FeK5CoOrPelEtdSxRvd3MHMdWK7+VT1bdzzcP QKgKhhPz87tcdMe0ZjyssL4Kc/cpU84FzeHkC1NTbqqC8YYDQQ0IeY7/IAgi3WJJ0TF6PR DZrsJbDlJFrGlKjbutMr8NcJmN8Ndvc= X-MC-Unique: HAinFh8RMGu84bg0FrpKlw-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 5/5] util: use g_auto in virNodeSuspendHelper Date: Mon, 13 Dec 2021 19:58:50 +0100 Message-Id: <99c6b2782fbacad70d80b9f9140b281e4356ae17.1639421880.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639421967527100001 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- src/util/virnodesuspend.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/util/virnodesuspend.c b/src/util/virnodesuspend.c index c92232dfe9..e1167605ca 100644 --- a/src/util/virnodesuspend.c +++ b/src/util/virnodesuspend.c @@ -102,7 +102,7 @@ static int virNodeSuspendSetNodeWakeup(unsigned long lo= ng alarmTime) */ static void virNodeSuspendHelper(void *cmdString) { - virCommand *suspendCmd =3D virCommandNew((const char *)cmdString); + g_autoptr(virCommand) suspendCmd =3D virCommandNew((const char *)cmdSt= ring); =20 /* * Delay for sometime so that the function virNodeSuspend() @@ -112,8 +112,6 @@ static void virNodeSuspendHelper(void *cmdString) if (virCommandRun(suspendCmd, NULL) < 0) VIR_WARN("Failed to suspend the host"); =20 - virCommandFree(suspendCmd); - /* * Now that we have resumed from suspend or the suspend failed, * reset 'aboutToSuspend' flag. --=20 2.31.1