[PATCH] Print errors on daemon startup if logging setup fails

Martin Kletzander mkletzan at redhat.com
Thu Jan 13 13:43:37 UTC 2022


https://bugzilla.redhat.com/show_bug.cgi?id=2039652

Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
---
 src/locking/lock_daemon.c  | 4 +++-
 src/logging/log_daemon.c   | 4 +++-
 src/remote/remote_daemon.c | 4 +++-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c
index ea81940a4325..75ebd059d79a 100644
--- a/src/locking/lock_daemon.c
+++ b/src/locking/lock_daemon.c
@@ -919,8 +919,10 @@ int main(int argc, char **argv) {
                               config->log_outputs,
                               privileged,
                               verbose,
-                              godaemon) < 0)
+                              godaemon) < 0) {
+        virDispatchError(NULL);
         exit(EXIT_FAILURE);
+    }
 
     if (!pid_file &&
         virPidFileConstructPath(privileged,
diff --git a/src/logging/log_daemon.c b/src/logging/log_daemon.c
index fe7fa8534aec..8c3eb66895dc 100644
--- a/src/logging/log_daemon.c
+++ b/src/logging/log_daemon.c
@@ -725,8 +725,10 @@ int main(int argc, char **argv) {
                               config->log_outputs,
                               privileged,
                               verbose,
-                              godaemon) < 0)
+                              godaemon) < 0) {
+        virDispatchError(NULL);
         exit(EXIT_FAILURE);
+    }
 
     if (!pid_file &&
         virPidFileConstructPath(privileged,
diff --git a/src/remote/remote_daemon.c b/src/remote/remote_daemon.c
index 84157e6cc19a..1b8e982a2f01 100644
--- a/src/remote/remote_daemon.c
+++ b/src/remote/remote_daemon.c
@@ -940,8 +940,10 @@ int main(int argc, char **argv) {
                               config->log_outputs,
                               privileged,
                               verbose,
-                              godaemon) < 0)
+                              godaemon) < 0) {
+        virDispatchError(NULL);
         exit(EXIT_FAILURE);
+    }
 
     /* Let's try to initialize global variable that holds the host's boot time. */
     if (virHostBootTimeInit() < 0) {
-- 
2.34.1




More information about the libvir-list mailing list