From f592b88d0cd965e20ca1f492cadb3b8c8fd48a40 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Thomas=20Wei=C3=9Fschuh?= Date: Sat, 15 Jan 2022 09:54:08 +0100 Subject: [PATCH] lspcu: Print dummy modelname if none present The logic in print_summary_cputype() starts a new hierarchy level under the CPUs "Model name" entry. If the model is unknown the hierarchy level will be skipped. This is visually confusing in the human-readable version and changes the schema of the JSON tree. --- sys-utils/lscpu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c index e11b2f42f0..32f989e381 100644 --- a/sys-utils/lscpu.c +++ b/sys-utils/lscpu.c @@ -859,8 +859,7 @@ print_summary_cputype(struct lscpu_cxt *cxt, struct libscols_table *tb, struct libscols_line *sec) { - if (ct->modelname) - sec = add_summary_s(tb, sec, _("Model name:"), ct->modelname); + sec = add_summary_s(tb, sec, _("Model name:"), ct->modelname ? ct->modelname : "-"); if (ct->bios_modelname) add_summary_s(tb, sec, _("BIOS Model name:"), ct->bios_modelname); if (ct->bios_family) -- 2.47.2