mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 21:34:54 +03:00
util: Do not hide errors in virLogSetDefaultOutput
Signed-off-by: Martin Kletzander <mkletzan@redhat.com> Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
3e54152d9f
commit
47fb83f8b7
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user