diff --git a/src/util/virlog.c b/src/util/virlog.c index 90d3d7c5cb..bf791d901a 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 460e54ba05..a04811e408 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