1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 17:35:35 +03:00

journalctl: show coredumps again when --unit= is specified

This effectively reverts fdcd37df3b.

After 888e378da2, coredumps for system
services are stored by systemd-coredump user. Henve, _UID=0 does not
match anything anymore.

Before:
```
$ build/journalctl -u systemd-networkd.service -p2 -n1
-- No entries --
```

After:
```
$ build/journalctl -u systemd-networkd.service -p2 -n1
Dec 06 05:39:55 H systemd-coredump[4187]: [🡕] Process 4145 (systemd-network) of user 192 dumped core.
(snip)
```
This commit is contained in:
Yu Watanabe 2024-12-06 06:57:39 +09:00 committed by Luca Boccassi
parent 2715cf6d96
commit cbd5f5d7d6

View File

@ -1653,7 +1653,6 @@ int add_matches_for_unit_full(sd_journal *j, bool all, const char *unit) {
/* Look for coredumps of the service */
(r = sd_journal_add_disjunction(j)) ||
(r = sd_journal_add_match(j, "MESSAGE_ID=" SD_MESSAGE_COREDUMP_STR, SIZE_MAX)) ||
(r = sd_journal_add_match(j, "_UID=0", SIZE_MAX)) ||
(r = journal_add_match_pair(j, "COREDUMP_UNIT", unit))
);
@ -1696,8 +1695,7 @@ int add_matches_for_user_unit_full(sd_journal *j, bool all, const char *unit) {
/* Look for coredumps of the service */
(r = sd_journal_add_disjunction(j)) ||
(r = journal_add_match_pair(j, "COREDUMP_USER_UNIT", unit)) ||
(r = journal_add_matchf(j, "_UID="UID_FMT, uid)) ||
(r = sd_journal_add_match(j, "_UID=0", SIZE_MAX))
(r = journal_add_matchf(j, "_UID="UID_FMT, uid))
);
if (r == 0 && all && endswith(unit, ".slice"))