The GLib g_lstat() function provides a portable impl for Win32. Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx> --- 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 = NULL; char *target = NULL; - struct stat sb; + GStatBuf sb; int ret = -1; bool isLink = false; bool isDev = false; @@ -14250,7 +14250,7 @@ qemuDomainCreateDeviceRecursive(const char *device, return ret; } - if (lstat(device, &sb) < 0) { + if (g_lstat(device, &sb) < 0) { if (errno == 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(virQEMUDriverPtr driver, data.vm = vm; data.file = file; - 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, path = g_strdup_printf("/proc/%d", (int)pid); - if (lstat(path, &sb) < 0) { + if (g_lstat(path, &sb) < 0) { virReportSystemError(errno, _("unable to get uid and gid for PID %d via procfs"), 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 stat *sb, char *base = last_component(path); bool noerror = (flags & VIR_STORAGE_VOL_OPEN_NOERROR); - if (lstat(path, sb) < 0) { + if (g_lstat(path, sb) < 0) { if (errno == 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 = NULL; g_autofree char *tmp = NULL; char *dirName; - struct stat sb; + GStatBuf sb; tmp = g_strdup(mntDir); @@ -241,7 +241,7 @@ virCgroupV1ResolveMountLink(const char *mntDir, linkSrc = g_strdup_printf("%s/%s", tmp, typeStr); *dirName = '/'; - if (lstat(linkSrc, &sb) < 0) { + if (g_lstat(linkSrc, &sb) < 0) { if (errno == 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) while ((direrr = virDirRead(dh, &de, dir)) > 0) { g_autofree char *filepath = NULL; - struct stat sb; + GStatBuf sb; filepath = g_strdup_printf("%s/%s", dir, de->d_name); - 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; *resultpath = NULL; @@ -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; if (!S_ISLNK(st.st_mode)) { @@ -1613,9 +1613,9 @@ virFileResolveAllLinks(const char *linkpath, char **resultpath) int virFileIsLink(const char *linkpath) { - struct stat st; + GStatBuf st; - if (lstat(linkpath, &st) < 0) + if (g_lstat(linkpath, &st) < 0) return -errno; return S_ISLNK(st.st_mode) != 0; -- 2.24.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list