summaryrefslogtreecommitdiffstats
path: root/src/coredump
diff options
context:
space:
mode:
authorLuca Boccassi <luca.boccassi@microsoft.com>2021-04-07 11:31:31 +0200
committerLuca Boccassi <luca.boccassi@microsoft.com>2021-04-07 15:02:38 +0200
commit671769c932ed4488035fc328a20c14ed15c8a47d (patch)
tree40eb301263dac8492c381caf206658cb7439452d /src/coredump
parentcoredump: use JSON helpers instead of creating objects manually (diff)
downloadsystemd-671769c932ed4488035fc328a20c14ed15c8a47d.tar.xz
systemd-671769c932ed4488035fc328a20c14ed15c8a47d.zip
coredump: rename COREDUMP_PKGMETA_ fields to COREDUMP_PACKAGE_
Follow-up for c546154a4448ddf9
Diffstat (limited to 'src/coredump')
-rw-r--r--src/coredump/coredump.c17
-rw-r--r--src/coredump/coredumpctl.c6
2 files changed, 7 insertions, 16 deletions
diff --git a/src/coredump/coredump.c b/src/coredump/coredump.c
index be813f57f1..2e56184025 100644
--- a/src/coredump/coredump.c
+++ b/src/coredump/coredump.c
@@ -792,7 +792,7 @@ log:
if (r < 0)
return log_error_errno(r, "Failed to format JSON package metadata: %m");
- (void) iovw_put_string_field(iovw, "COREDUMP_PKGMETA_JSON=", formatted_json);
+ (void) iovw_put_string_field(iovw, "COREDUMP_PACKAGE_JSON=", formatted_json);
}
JSON_VARIANT_OBJECT_FOREACH(module_name, module_json, json_metadata) {
@@ -822,7 +822,6 @@ log:
w = json_variant_by_index(_state2.variant, _state2.idx + 1); \
true; }); \
_state2.idx += 2) {
- _cleanup_free_ char *metadata_id = NULL, *key_upper = NULL;
if (!json_variant_is_string(w))
continue;
@@ -830,17 +829,9 @@ log:
if (!STR_IN_SET(key, "package", "packageVersion"))
continue;
- /* Journal metadata field names need to be upper case */
- key_upper = strdup(key);
- if (!key_upper)
- return log_oom();
- key_upper = ascii_strupper(key_upper);
-
- metadata_id = strjoin("COREDUMP_PKGMETA_", key_upper, "=");
- if (!metadata_id)
- return log_oom();
-
- (void) iovw_put_string_field(iovw, metadata_id, json_variant_string(w));
+ (void) iovw_put_string_field(iovw,
+ streq(key, "package") ? "COREDUMP_PACKAGE_NAME=" : "COREDUMP_PACKAGE_VERSION=",
+ json_variant_string(w));
}
}
diff --git a/src/coredump/coredumpctl.c b/src/coredump/coredumpctl.c
index 0787eeafef..219f201a55 100644
--- a/src/coredump/coredumpctl.c
+++ b/src/coredump/coredumpctl.c
@@ -575,9 +575,9 @@ static int print_info(FILE *file, sd_journal *j, bool need_space) {
RETRIEVE(d, l, "COREDUMP_FILENAME", filename);
RETRIEVE(d, l, "COREDUMP_TRUNCATED", truncated);
RETRIEVE(d, l, "COREDUMP", coredump);
- RETRIEVE(d, l, "COREDUMP_PKGMETA_PACKAGE", pkgmeta_name);
- RETRIEVE(d, l, "COREDUMP_PKGMETA_PACKAGEVERSION", pkgmeta_version);
- RETRIEVE(d, l, "COREDUMP_PKGMETA_JSON", pkgmeta_json);
+ RETRIEVE(d, l, "COREDUMP_PACKAGE_NAME", pkgmeta_name);
+ RETRIEVE(d, l, "COREDUMP_PACKAGE_VERSION", pkgmeta_version);
+ RETRIEVE(d, l, "COREDUMP_PACKAGE_JSON", pkgmeta_json);
RETRIEVE(d, l, "_BOOT_ID", boot_id);
RETRIEVE(d, l, "_MACHINE_ID", machine_id);
RETRIEVE(d, l, "MESSAGE", message);