systemd/SOURCES/1007-coredump-actually-store-parsed-unit-in-the-context.patch

36 lines
1.3 KiB
Diff

From ccaa361e04719efc6bcf7f3201cc9e6a869677d8 Mon Sep 17 00:00:00 2001
From: Michal Sekletar <msekleta@redhat.com>
Date: Mon, 4 Mar 2024 14:40:32 +0100
Subject: [PATCH] coredump: actually store parsed unit in the context
RHEL-only
Related: RHEL-18302
---
src/coredump/coredump.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/coredump/coredump.c b/src/coredump/coredump.c
index d8acd2d3a7..7af8e97877 100644
--- a/src/coredump/coredump.c
+++ b/src/coredump/coredump.c
@@ -1262,6 +1262,8 @@ static int gather_pid_metadata(
context->meta[CONTEXT_EXE] = t;
if (cg_pid_get_unit(pid, &t) >= 0) {
+ context->meta[CONTEXT_UNIT] = t;
+
if (!is_journald_crash(context)) {
/* OK, now we know it's not the journal, hence we can make use of it now. */
log_set_target(LOG_TARGET_JOURNAL_OR_KMSG);
@@ -1275,8 +1277,7 @@ static int gather_pid_metadata(
}
set_iovec_string_field(iovec, n_iovec, "COREDUMP_UNIT=", context->meta[CONTEXT_UNIT]);
- } else
- context->meta[CONTEXT_UNIT] = t;
+ }
if (cg_pid_get_user_unit(pid, &t) >= 0)
set_iovec_field_free(iovec, n_iovec, "COREDUMP_USER_UNIT=", t);