mirror of
https://github.com/morgan9e/systemd
synced 2026-04-15 00:47:10 +09:00
elf-util: drop assertion for metadata in report_module_metadata()
Fixes a bug introduced by 1a0281a3eb.
Fixes RHBZ#2134741 (https://bugzilla.redhat.com/show_bug.cgi?id=2134741).
This commit is contained in:
committed by
Zbigniew Jędrzejewski-Szmek
parent
417cbcd6be
commit
f6e88aac2c
@@ -293,29 +293,30 @@ static char* build_package_reference(
|
||||
static void report_module_metadata(StackContext *c, const char *name, JsonVariant *metadata) {
|
||||
assert(c);
|
||||
assert(name);
|
||||
assert(metadata);
|
||||
|
||||
if (!c->f)
|
||||
return;
|
||||
|
||||
const char
|
||||
*build_id = json_variant_string(json_variant_by_key(metadata, "buildId")),
|
||||
*type = json_variant_string(json_variant_by_key(metadata, "type")),
|
||||
*package = json_variant_string(json_variant_by_key(metadata, "name")),
|
||||
*version = json_variant_string(json_variant_by_key(metadata, "version")),
|
||||
*arch = json_variant_string(json_variant_by_key(metadata, "architecture"));
|
||||
|
||||
fprintf(c->f, "Module %s", name);
|
||||
|
||||
if (package) {
|
||||
/* Version/architecture is only meaningful with a package name.
|
||||
* Skip the detailed fields if package is unknown. */
|
||||
_cleanup_free_ char *id = build_package_reference(type, package, version, arch);
|
||||
fprintf(c->f, " from %s", strnull(id));
|
||||
}
|
||||
if (metadata) {
|
||||
const char
|
||||
*build_id = json_variant_string(json_variant_by_key(metadata, "buildId")),
|
||||
*type = json_variant_string(json_variant_by_key(metadata, "type")),
|
||||
*package = json_variant_string(json_variant_by_key(metadata, "name")),
|
||||
*version = json_variant_string(json_variant_by_key(metadata, "version")),
|
||||
*arch = json_variant_string(json_variant_by_key(metadata, "architecture"));
|
||||
|
||||
if (build_id && !(package && version))
|
||||
fprintf(c->f, ", build-id=%s", build_id);
|
||||
if (package) {
|
||||
/* Version/architecture is only meaningful with a package name.
|
||||
* Skip the detailed fields if package is unknown. */
|
||||
_cleanup_free_ char *id = build_package_reference(type, package, version, arch);
|
||||
fprintf(c->f, " from %s", strnull(id));
|
||||
}
|
||||
|
||||
if (build_id && !(package && version))
|
||||
fprintf(c->f, ", build-id=%s", build_id);
|
||||
}
|
||||
|
||||
fputs("\n", c->f);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user