From: Marc-André Lureau <marcandre.lureau(a)redhat.com>
Whether a directory is missing or is not readable doesn't make much
difference when populating the available configs.
This removes errors when firmare or vhost-user config is looked up
from a user session libvirt if /etc/libvirt is not readable for ex.
Signed-off-by: Marc-André Lureau <marcandre.lureau(a)redhat.com>
---
src/qemu/qemu_interop_config.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_interop_config.c b/src/qemu/qemu_interop_config.c
index 1f39d4b576..f3c5d2e083 100644
--- a/src/qemu/qemu_interop_config.c
+++ b/src/qemu/qemu_interop_config.c
@@ -41,8 +41,14 @@ qemuBuildFileList(virHashTablePtr files, const char *dir)
int rc;
int ret = -1;
- if ((rc = virDirOpenIfExists(&dirp, dir)) < 0)
+ if ((rc = virDirOpenIfExists(&dirp, dir)) < 0) {
+ /* silently ignore unreadable directories */
+ if (virLastErrorIsSystemErrno(EACCES)) {
+ virResetLastError();
+ return 0;
+ }
return -1;
+ }
if (rc == 0)
return 0;
--
2.23.0