forked from pool/libvirt
376a708d02
Properly fix failing tests. - Fix and re-enable snapshot tests f66f70ac-snapshot-fix-use-after-free.patch 2a07c990-api-CVE-2019-3886.patch, ae076bb4-remote-CVE-2019-3886.patch - spec: BuildRequires rpcgen since ae076bb4-remote-CVE-2019-3886.patch ebe9c6ea-qemu-firmware-dirent.patch OBS-URL: https://build.opensuse.org/request/show/693774 OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=746
44 lines
1.5 KiB
Diff
44 lines
1.5 KiB
Diff
commit ebe9c6eab77e2da500c24430addfcd9f10b1676d
|
|
Author: Daniel P. Berrangé <berrange@redhat.com>
|
|
Date: Tue Apr 2 13:27:44 2019 +0100
|
|
|
|
qemu: don't rely on the non-portable d_type field in dirent
|
|
|
|
d_type is a non-portable extension to the struct dirent and even if it
|
|
exists, its value may be DT_UNKNOWN if the filesystem doesn't support
|
|
it. This is common with older versions of XFS which have ftype=0
|
|
feature.
|
|
|
|
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
|
|
|
Index: libvirt-5.2.0/src/qemu/qemu_firmware.c
|
|
===================================================================
|
|
--- libvirt-5.2.0.orig/src/qemu/qemu_firmware.c
|
|
+++ libvirt-5.2.0/src/qemu/qemu_firmware.c
|
|
@@ -924,9 +924,7 @@ qemuFirmwareBuildFileList(virHashTablePt
|
|
while ((rc = virDirRead(dirp, &ent, dir)) > 0) {
|
|
VIR_AUTOFREE(char *) filename = NULL;
|
|
VIR_AUTOFREE(char *) path = NULL;
|
|
-
|
|
- if (ent->d_type != DT_REG && ent->d_type != DT_LNK)
|
|
- continue;
|
|
+ struct stat sb;
|
|
|
|
if (STRPREFIX(ent->d_name, "."))
|
|
continue;
|
|
@@ -937,6 +935,14 @@ qemuFirmwareBuildFileList(virHashTablePt
|
|
if (virAsprintf(&path, "%s/%s", dir, filename) < 0)
|
|
goto cleanup;
|
|
|
|
+ if (stat(path, &sb) < 0) {
|
|
+ virReportSystemError(errno, _("Unable to access %s"), path);
|
|
+ goto cleanup;
|
|
+ }
|
|
+
|
|
+ if (!S_ISREG(sb.st_mode) && !S_ISLNK(sb.st_mode))
|
|
+ continue;
|
|
+
|
|
if (virHashUpdateEntry(files, filename, path) < 0)
|
|
goto cleanup;
|
|
|