[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] Don't exist if the libvirtd config does not exist



From: "Daniel P. Berrange" <berrange redhat com>

It is common for the $HOME/.libvirt/libvirtd.conf file to not
exist. Treat this situation as non-fatal since we can carry
on with our default settings just fine.

* daemon/libvirtd.c: Treat ENOENT as non-fatal when loading
  config
---
 daemon/libvirtd.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 06d2077..fe0fa27 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -1028,6 +1028,10 @@ daemonConfigLoad(struct daemonConfig *data,
 {
     virConfPtr conf;
 
+    if (access(filename, R_OK) == -1 &&
+        errno == ENOENT)
+        return 0;
+
     conf = virConfReadFile (filename, 0);
     if (!conf)
         return -1;
-- 
1.7.6


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]