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

Martin Kletzander posted 1 patch 2 years, 3 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/e6d3f98e6a6d8db7a91e99269329d8a0f6c37a61.1642081417.git.mkletzan@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(-)
[PATCH] Print errors on daemon startup if logging setup fails
Posted by Martin Kletzander 2 years, 3 months ago
https://bugzilla.redhat.com/show_bug.cgi?id=2039652

Signed-off-by: Martin Kletzander <mkletzan@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

Re: [PATCH] Print errors on daemon startup if logging setup fails
Posted by Ján Tomko 2 years, 3 months ago
On a Thursday in 2022, Martin Kletzander wrote:
>https://bugzilla.redhat.com/show_bug.cgi?id=2039652
>

Fixes: a873924e36b28c5b125621e35b32beb6b077bcc8

>Signed-off-by: Martin Kletzander <mkletzan@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(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano