From nobody Sun Feb 8 03:33:02 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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=1577977016; cv=none; d=zohomail.com; s=zohoarc; b=mCVGQXB2curlHkAPbSrOX7UAQ9844TyXEvdgDTMZ2k1bFuQnfAKntQUsUAVS6i8fFlzAbm14Hz+VG4tECPHb84IQ+MgnyZu2hW0Xuo0JKUHfhlF3k5TRPtXfixRcsI8XKWpbFBGyFNd0rOshzQgNo02ya6BzAon4pCuRxhWyMZ0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577977016; 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=Q2aEG8LUhjM4P/igOhUDrzv62txnb9guQPu2TOhFM7w=; b=dBIn002Kmx4aHqt4GsTI2isBHNRi2ZendRXwtYZoPgZN4OVHavtAix66YdwbBXn8OmbxxvPRkubddUdYyNLBhLOAFo7uFbVfdevG6+8swcYUD3M2N/dtt0DBCSGhGR12jcHsUhkRrcKj+A+pb1n8K405y1p/PExCD87ZyFw1lFI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1577977016036609.5304614782488; Thu, 2 Jan 2020 06:56:56 -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-311-vXLBgUvTMmuJwgYzNwQz8Q-1; Thu, 02 Jan 2020 09:56:53 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6EB25800D50; Thu, 2 Jan 2020 14:56:46 +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 4024B5DA82; Thu, 2 Jan 2020 14:56:46 +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 EEEF781E3E; Thu, 2 Jan 2020 14:56:45 +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 002EuZo1004807 for ; Thu, 2 Jan 2020 09:56:35 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6B28560C88; Thu, 2 Jan 2020 14:56:35 +0000 (UTC) Received: from catbus.gsslab.fab.redhat.com (dhcp-43.gsslab.fab.redhat.com [10.33.9.43]) by smtp.corp.redhat.com (Postfix) with ESMTP id CFA2160C85; Thu, 2 Jan 2020 14:56:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577977015; 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=Q2aEG8LUhjM4P/igOhUDrzv62txnb9guQPu2TOhFM7w=; b=WeoQ6oXUYeXhEXFdCsLHHoT0vA4MEQitgjQtMR+uMEreymQQ6ns3Oz5KUSQJVQsCrRkKiZ Ovuw2TjBBCV9inag0cKwXr1V/wUahNGXLCqLAh8piX3dzmbdGyhB5R25Y5Koc1Xyi5G9xK 6mHvPtXWrknveI9DkVPGNlVFLzvGGyM= From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Thu, 2 Jan 2020 14:53:44 +0000 Message-Id: <20200102145357.6724-11-berrange@redhat.com> In-Reply-To: <20200102145357.6724-1-berrange@redhat.com> References: <20200102145357.6724-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 10/23] src: use g_lstat() instead of lstat() 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.14 X-MC-Unique: vXLBgUvTMmuJwgYzNwQz8Q-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) The GLib g_lstat() function provides a portable impl for Win32. Signed-off-by: Daniel P. Berrang=C3=A9 --- src/qemu/qemu_domain.c | 8 ++++---- src/security/security_dac.c | 2 +- src/storage/storage_util.c | 2 +- src/util/vircgroupv1.c | 4 ++-- src/util/virfile.c | 12 ++++++------ 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index ff87720fd1..187aaf5737 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -14232,7 +14232,7 @@ qemuDomainCreateDeviceRecursive(const char *device, { char *devicePath =3D NULL; char *target =3D NULL; - struct stat sb; + GStatBuf sb; int ret =3D -1; bool isLink =3D false; bool isDev =3D false; @@ -14250,7 +14250,7 @@ qemuDomainCreateDeviceRecursive(const char *device, return ret; } =20 - if (lstat(device, &sb) < 0) { + if (g_lstat(device, &sb) < 0) { if (errno =3D=3D ENOENT && allow_noent) { /* Ignore non-existent device. */ return 0; @@ -15106,7 +15106,7 @@ struct qemuDomainAttachDeviceMknodData { virDomainObjPtr vm; const char *file; const char *target; - struct stat sb; + GStatBuf sb; void *acl; #ifdef WITH_SELINUX char *tcon; @@ -15284,7 +15284,7 @@ qemuDomainAttachDeviceMknodRecursive(virQEMUDriverP= tr driver, data.vm =3D vm; data.file =3D file; =20 - if (lstat(file, &data.sb) < 0) { + if (g_lstat(file, &data.sb) < 0) { virReportSystemError(errno, _("Unable to access %s"), file); return ret; diff --git a/src/security/security_dac.c b/src/security/security_dac.c index 411aa1b159..ccd3874897 100644 --- a/src/security/security_dac.c +++ b/src/security/security_dac.c @@ -2365,7 +2365,7 @@ virSecurityDACGetProcessLabelInternal(pid_t pid, =20 path =3D g_strdup_printf("/proc/%d", (int)pid); =20 - if (lstat(path, &sb) < 0) { + if (g_lstat(path, &sb) < 0) { virReportSystemError(errno, _("unable to get uid and gid for PID %d via p= rocfs"), pid); diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c index 45ffd2206e..58225c09f5 100644 --- a/src/storage/storage_util.c +++ b/src/storage/storage_util.c @@ -1522,7 +1522,7 @@ virStorageBackendVolOpen(const char *path, struct sta= t *sb, char *base =3D last_component(path); bool noerror =3D (flags & VIR_STORAGE_VOL_OPEN_NOERROR); =20 - if (lstat(path, sb) < 0) { + if (g_lstat(path, sb) < 0) { if (errno =3D=3D ENOENT) { if (noerror) { VIR_WARN("ignoring missing file '%s'", path); diff --git a/src/util/vircgroupv1.c b/src/util/vircgroupv1.c index 4f6b89cf2e..d2ec7106db 100644 --- a/src/util/vircgroupv1.c +++ b/src/util/vircgroupv1.c @@ -223,7 +223,7 @@ virCgroupV1ResolveMountLink(const char *mntDir, g_autofree char *linkSrc =3D NULL; g_autofree char *tmp =3D NULL; char *dirName; - struct stat sb; + GStatBuf sb; =20 tmp =3D g_strdup(mntDir); =20 @@ -241,7 +241,7 @@ virCgroupV1ResolveMountLink(const char *mntDir, linkSrc =3D g_strdup_printf("%s/%s", tmp, typeStr); *dirName =3D '/'; =20 - if (lstat(linkSrc, &sb) < 0) { + if (g_lstat(linkSrc, &sb) < 0) { if (errno =3D=3D ENOENT) { VIR_WARN("Controller %s co-mounted at %s is missing symlink at= %s", typeStr, tmp, linkSrc); diff --git a/src/util/virfile.c b/src/util/virfile.c index c79fe86403..97f86a46e9 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -1002,11 +1002,11 @@ int virFileDeleteTree(const char *dir) =20 while ((direrr =3D virDirRead(dh, &de, dir)) > 0) { g_autofree char *filepath =3D NULL; - struct stat sb; + GStatBuf sb; =20 filepath =3D g_strdup_printf("%s/%s", dir, de->d_name); =20 - if (lstat(filepath, &sb) < 0) { + if (g_lstat(filepath, &sb) < 0) { virReportSystemError(errno, _("Cannot access '%s'"), filepath); goto cleanup; @@ -1555,7 +1555,7 @@ virFileResolveLinkHelper(const char *linkpath, bool intermediatePaths, char **resultpath) { - struct stat st; + GStatBuf st; =20 *resultpath =3D NULL; =20 @@ -1563,7 +1563,7 @@ virFileResolveLinkHelper(const char *linkpath, * directories, if linkpath is absolute and the basename is * already a non-symlink. */ if (IS_ABSOLUTE_FILE_NAME(linkpath) && !intermediatePaths) { - if (lstat(linkpath, &st) < 0) + if (g_lstat(linkpath, &st) < 0) return -1; =20 if (!S_ISLNK(st.st_mode)) { @@ -1613,9 +1613,9 @@ virFileResolveAllLinks(const char *linkpath, char **r= esultpath) int virFileIsLink(const char *linkpath) { - struct stat st; + GStatBuf st; =20 - if (lstat(linkpath, &st) < 0) + if (g_lstat(linkpath, &st) < 0) return -errno; =20 return S_ISLNK(st.st_mode) !=3D 0; --=20 2.24.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list