From nobody Sun Feb 8 14:57:45 2026 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 --- 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