From nobody Mon Feb 9 17:24:16 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 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=1573650445; cv=none; d=zoho.com; s=zohoarc; b=aEsbsl9QPcvOA5u0WdL0mCyHrvgL8VqbMOxYAbSjlWeAP3G3ehpV42gHHKp2hD6CewGWflSWz5fyqgdmukccxJTlTty5IW2UIwRKbm59lM7+Fst6fPxdqf+HYcqRKCSBiwZ9Zu9beYCBZa8ed57FfeIz3oEpoJ/EQGFKUcjBxrI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573650445; 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=p0xIq/t+kLYOcUjaRcnuSnfDQdlNwErn4+/AWJHVMbE=; b=UVwf4HnyvBlSi/mOXhvzT8989U48pVWpn6IpYw1yx23z/lrGJURh7BM+3FP9WLVUlTr44ZMEUOIZjBzam9wmyIkkCzShRmdYS8JpB9qpWsPqqD+oc/SXVSNPo6flfo+ezRfTYbT7VkmRApv6OF44WFd8O4zvtFygfrHjlXjGqKw= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1573650445755333.7925171367449; Wed, 13 Nov 2019 05:07:25 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-396-JI-kst0kPLuE5mNxWuHYuw-1; Wed, 13 Nov 2019 08:07:23 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 042F518A23E1; Wed, 13 Nov 2019 13:07:18 +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 C86FB60BE0; Wed, 13 Nov 2019 13:07: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 6FCC765D1C; Wed, 13 Nov 2019 13:07: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 xADD7Eim007063 for ; Wed, 13 Nov 2019 08:07:14 -0500 Received: by smtp.corp.redhat.com (Postfix) id 63A3BBA45; Wed, 13 Nov 2019 13:07:14 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id E168B60CCC for ; Wed, 13 Nov 2019 13:07:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573650444; 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=p0xIq/t+kLYOcUjaRcnuSnfDQdlNwErn4+/AWJHVMbE=; b=PxpdKo6f/JuHCwPCNIM1gz+9x+TgGCSH7/v513RVj9KYDlFAzXc6nVhWPaShCKttAofW8I 0lQHyud3bR8PYJbZrAZldpMruU9NVzk9hrkLYvaniRtBLW7MyRSu585NdWJU/f4cyFHOYK YA6OuAXWeoZGn+RAh03hlG8UQq9sdeM= From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 13 Nov 2019 14:07:02 +0100 Message-Id: <79c66466b1f2429481ea4654c7990023c00c6eb8.1573649215.git.pkrempa@redhat.com> 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 1/8] qemu: domain: Use g_file_read_link instead of virFileReadLink 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.12 X-MC-Unique: JI-kst0kPLuE5mNxWuHYuw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" In an effort to remove as much gnulib usage as possible let's reimplement virFileReadLink. Since it's used in two places only I opted to open-code it. Signed-off-by: Peter Krempa --- src/qemu/qemu_domain.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 842b70dc26..40a617845a 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -13170,12 +13170,13 @@ qemuDomainCreateDeviceRecursive(const char *devic= e, } if (isLink) { + g_autoptr(GError) gerr =3D NULL; + /* We are dealing with a symlink. Create a dangling symlink and de= scend * down one level which hopefully creates the symlink's target. */ - if (virFileReadLink(device, &target) < 0) { - virReportSystemError(errno, - _("unable to resolve symlink %s"), - device); + if (!(target =3D g_file_read_link(device, &gerr))) { + virReportError(VIR_ERR_SYSTEM_ERROR, + _("failed to resolve symlink %s: %s"), device, = gerr->message); goto cleanup; } @@ -14164,10 +14165,11 @@ qemuDomainAttachDeviceMknodRecursive(virQEMUDrive= rPtr driver, data.target =3D target; } else if (isLink) { - if (virFileReadLink(file, &target) < 0) { - virReportSystemError(errno, - _("unable to resolve symlink %s"), - file); + g_autoptr(GError) gerr =3D NULL; + + if (!(target =3D g_file_read_link(file, &gerr))) { + virReportError(VIR_ERR_SYSTEM_ERROR, + _("failed to resolve symlink %s: %s"), file, ge= rr->message); return ret; } --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list