mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-23 01:18:53 +02:00
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
This commit is contained in:
@@ -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,
|
fd_is_journal = g_str_has_prefix (((struct sockaddr_un *)&addr)->sun_path,
|
||||||
"/run/systemd/journal/");
|
"/run/systemd/journal/");
|
||||||
|
|
||||||
if (fd_is_journal)
|
|
||||||
open_journal ();
|
|
||||||
|
|
||||||
g_once_init_leave (&initialized, TRUE);
|
g_once_init_leave (&initialized, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1822,6 +1819,9 @@ journal_sendv (struct iovec *iov,
|
|||||||
struct cmsghdr *cmsg;
|
struct cmsghdr *cmsg;
|
||||||
char path[] = "/dev/shm/journal.XXXXXX";
|
char path[] = "/dev/shm/journal.XXXXXX";
|
||||||
|
|
||||||
|
if (journal_fd < 0)
|
||||||
|
open_journal ();
|
||||||
|
|
||||||
if (journal_fd < 0)
|
if (journal_fd < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user