[glib] gmessages: Don’t require is_journald() call before writer_journald()
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] gmessages: Don’t require is_journald() call before writer_journald()
- Date: Thu, 4 Aug 2016 13:33:46 +0000 (UTC)
commit 5c3205f2fb0f8bf4bbce7e1e532e834ad36da633
Author: Philip Withnall <philip withnall collabora co uk>
Date: Thu Aug 4 10:35:27 2016 +0100
gmessages: Don’t require is_journald() call before writer_journald()
g_log_writer_is_journald() works out whether the process’ stderr or
stdout are redirected to journald. While the default writer function
uses this in conjunction with g_log_writer_journald(), that does not
always have to be the case — other writer functions might want to always
write to the journal, and never write to stderr (for example).
Consequently, automatically open the journal socket in
writer_journald(), rather than is_journald().
https://bugzilla.gnome.org/show_bug.cgi?id=769507
glib/gmessages.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/glib/gmessages.c b/glib/gmessages.c
index c2c4310..77ee308 100644
--- a/glib/gmessages.c
+++ b/glib/gmessages.c
@@ -1687,9 +1687,6 @@ g_log_writer_is_journald (gint output_fd)
fd_is_journal = g_str_has_prefix (((struct sockaddr_un *)&addr)->sun_path,
"/run/systemd/journal/");
- if (fd_is_journal)
- open_journal ();
-
g_once_init_leave (&initialized, TRUE);
}
@@ -1823,6 +1820,9 @@ journal_sendv (struct iovec *iov,
char path[] = "/dev/shm/journal.XXXXXX";
if (journal_fd < 0)
+ open_journal ();
+
+ if (journal_fd < 0)
return -1;
memset (&sa, 0, sizeof (sa));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]