From nobody Mon Feb 9 19:07:50 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1551884480190390.58089661544216; Wed, 6 Mar 2019 07:01:20 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 28CF580472; Wed, 6 Mar 2019 15:01: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 D4E4D1001DCA; Wed, 6 Mar 2019 15:01:17 +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 387801819AFB; Wed, 6 Mar 2019 15:01:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x26ExQni009281 for ; Wed, 6 Mar 2019 09:59:26 -0500 Received: by smtp.corp.redhat.com (Postfix) id C47516B485; Wed, 6 Mar 2019 14:59:26 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4962A6B483 for ; Wed, 6 Mar 2019 14:59:24 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Wed, 6 Mar 2019 15:59:11 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 1/8] iscsi_direct: Make virStorageBackendISCSIDirectGetLun report error properly 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 06 Mar 2019 15:01:18 +0000 (UTC) Content-Type: text/plain; charset="utf-8" This function reports error for one of the two error paths. This is unfortunate as a caller see this function failing but doesn't know right away if an error was reported. Signed-off-by: Michal Privoznik Reviewed-by: Pavel Hrdina --- src/storage/storage_backend_iscsi_direct.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/storage/storage_backend_iscsi_direct.c b/src/storage/stora= ge_backend_iscsi_direct.c index 786663534d..fc3b6550f7 100644 --- a/src/storage/storage_backend_iscsi_direct.c +++ b/src/storage/storage_backend_iscsi_direct.c @@ -605,22 +605,16 @@ static int virStorageBackendISCSIDirectGetLun(virStorageVolDefPtr vol, int *lun) { - const char *name =3D vol->name; - int ret =3D -1; + const char *name; =20 - if (!STRPREFIX(name, VOL_NAME_PREFIX)) { + if (!(name =3D STRSKIP(vol->name, VOL_NAME_PREFIX)) || + virStrToLong_i(name, NULL, 10, lun) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Invalid volume name %s"), name); - goto cleanup; + _("Invalid volume name %s"), vol->name); + return -1; } =20 - name +=3D strlen(VOL_NAME_PREFIX); - if (virStrToLong_i(name, NULL, 10, lun) < 0) - goto cleanup; - - ret =3D 0; - cleanup: - return ret; + return 0; } =20 static int --=20 2.19.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list