Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
src/util/virlog.c | 8 +++++---
src/util/virlog.h | 2 +-
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/util/virlog.c b/src/util/virlog.c
index 90d3d7c5cb53..bf791d901a24 100644
--- a/src/util/virlog.c
+++ b/src/util/virlog.c
@@ -201,7 +201,7 @@ virLogSetDefaultOutputToFile(const char *binary, bool privileged)
* according to @binary, @godaemon, @privileged. This function should be run
* exactly once at daemon startup, so no locks are used.
*/
-void
+int
virLogSetDefaultOutput(const char *binary, bool godaemon, bool privileged)
{
bool have_journald = access("/run/systemd/journal/socket", W_OK) >= 0;
@@ -209,14 +209,16 @@ virLogSetDefaultOutput(const char *binary, bool godaemon, bool
privileged)
if (godaemon) {
if (have_journald)
virLogSetDefaultOutputToJournald();
- else
- virLogSetDefaultOutputToFile(binary, privileged);
+ else if (virLogSetDefaultOutputToFile(binary, privileged) < 0)
+ return -1;
} else {
if (!isatty(STDIN_FILENO) && have_journald)
virLogSetDefaultOutputToJournald();
else
virLogSetDefaultOutputToStderr();
}
+
+ return 0;
}
diff --git a/src/util/virlog.h b/src/util/virlog.h
index 460e54ba0501..a04811e4083c 100644
--- a/src/util/virlog.h
+++ b/src/util/virlog.h
@@ -154,7 +154,7 @@ void virLogFilterListFree(virLogFilter **list, int count);
int virLogSetOutputs(const char *outputs);
int virLogSetFilters(const char *filters);
char *virLogGetDefaultOutput(void);
-void virLogSetDefaultOutput(const char *fname, bool godaemon, bool privileged);
+int virLogSetDefaultOutput(const char *fname, bool godaemon, bool privileged);
/*
* Internal logging API
--
2.34.1