From nobody Thu May 15 22:48:07 2025 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1503580158742693.9744721566414; Thu, 24 Aug 2017 06:09:18 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CA638C056797; Thu, 24 Aug 2017 13:09:16 +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 AC6C77B9C5; Thu, 24 Aug 2017 13:09:16 +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 0F8FF3FC72; Thu, 24 Aug 2017 13:09:15 +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 v7OD9Esk027814 for ; Thu, 24 Aug 2017 09:09:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4C9647B8D4; Thu, 24 Aug 2017 13:09:14 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-123-165.rdu2.redhat.com [10.10.123.165]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1B15D7B9CA for ; Thu, 24 Aug 2017 13:09:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com CA638C056797 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: John Ferlan To: libvir-list@redhat.com Date: Thu, 24 Aug 2017 09:09:00 -0400 Message-Id: <20170824130905.5199-8-jferlan@redhat.com> In-Reply-To: <20170824130905.5199-1-jferlan@redhat.com> References: <20170824130905.5199-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 07/12] storage: Use virStoragePoolObjGetAutostartLink 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 24 Aug 2017 13:09:17 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Use the new accessor API for storage_driver. Signed-off-by: John Ferlan --- src/storage/storage_driver.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index 7b1396f..a7a77ba 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -814,6 +814,7 @@ static int storagePoolUndefine(virStoragePoolPtr pool) { virStoragePoolObjPtr obj; + const char *autostartLink; virObjectEventPtr event =3D NULL; int ret =3D -1; =20 @@ -838,18 +839,17 @@ storagePoolUndefine(virStoragePoolPtr pool) goto cleanup; } =20 + autostartLink =3D virStoragePoolObjGetAutostartLink(obj); if (virStoragePoolObjDeleteDef(obj) < 0) goto cleanup; =20 - if (unlink(obj->autostartLink) < 0 && - errno !=3D ENOENT && - errno !=3D ENOTDIR) { + if (autostartLink && unlink(autostartLink) < 0 && + errno !=3D ENOENT && errno !=3D ENOTDIR) { char ebuf[1024]; VIR_ERROR(_("Failed to delete autostart link '%s': %s"), - obj->autostartLink, virStrerror(errno, ebuf, sizeof(ebuf= ))); + autostartLink, virStrerror(errno, ebuf, sizeof(ebuf))); } =20 - VIR_FREE(obj->autostartLink); =20 event =3D virStoragePoolEventLifecycleNew(obj->def->name, obj->def->uuid, @@ -1268,6 +1268,7 @@ storagePoolSetAutostart(virStoragePoolPtr pool, { virStoragePoolObjPtr obj; const char *configFile; + const char *autostartLink; int ret =3D -1; =20 storageDriverLock(); @@ -1283,6 +1284,8 @@ storagePoolSetAutostart(virStoragePoolPtr pool, goto cleanup; } =20 + autostartLink =3D virStoragePoolObjGetAutostartLink(obj); + autostart =3D (autostart !=3D 0); =20 if (obj->autostart !=3D autostart) { @@ -1294,18 +1297,18 @@ storagePoolSetAutostart(virStoragePoolPtr pool, goto cleanup; } =20 - if (symlink(configFile, obj->autostartLink) < 0) { + if (symlink(configFile, autostartLink) < 0) { virReportSystemError(errno, _("Failed to create symlink '%s' to '= %s'"), - obj->autostartLink, configFile); + autostartLink, configFile); goto cleanup; } } else { - if (unlink(obj->autostartLink) < 0 && + if (autostartLink && unlink(autostartLink) < 0 && errno !=3D ENOENT && errno !=3D ENOTDIR) { virReportSystemError(errno, _("Failed to delete symlink '%s'"), - obj->autostartLink); + autostartLink); goto cleanup; } } --=20 2.9.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list