diff options
author | Philip Withnall <pwithnall@endlessos.org> | 2021-11-16 14:43:12 +0000 |
---|---|---|
committer | Philip Withnall <pwithnall@endlessos.org> | 2021-11-16 14:43:12 +0000 |
commit | fc4070a047d3e85950e65060337334e08c7009a4 (patch) | |
tree | b55a9cc9f84bcd90d03ccc23f2bc5caec9fea2f5 /glib/gmessages.c | |
parent | 1f1bf730a2ebec35bfc67e944b5ac43855c8c71f (diff) | |
download | glib-fc4070a047d3e85950e65060337334e08c7009a4.tar.gz |
gmessages: Support namespaced journals
Spotted and diagnosed by Ilya Basin.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Fixes: #2530
Diffstat (limited to 'glib/gmessages.c')
-rw-r--r-- | glib/gmessages.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/glib/gmessages.c b/glib/gmessages.c index 7affcd4d9..2e8a34817 100644 --- a/glib/gmessages.c +++ b/glib/gmessages.c @@ -2225,10 +2225,14 @@ g_log_writer_is_journald (gint output_fd) if (output_fd < 0) return FALSE; + /* Namespaced journals start with `/run/systemd/journal.${name}/` (see + * `RuntimeDirectory=systemd/journal.%i` in `systemd-journald@.service`. The + * default journal starts with `/run/systemd/journal/`. */ addr_len = sizeof(addr); err = getpeername (output_fd, &addr.sa, &addr_len); if (err == 0 && addr.storage.ss_family == AF_UNIX) - return g_str_has_prefix (addr.un.sun_path, "/run/systemd/journal/"); + return (g_str_has_prefix (addr.un.sun_path, "/run/systemd/journal/") || + g_str_has_prefix (addr.un.sun_path, "/run/systemd/journal.")); #endif return FALSE; |