From 9fe4e68cabaf79681388d025d86bd14f5ae944a6 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Sat, 29 Jul 2023 21:04:44 +0200 Subject: [PATCH] analyze: fix pcrs verb output without TPM support If we don't have TPM support then `alg` is NULL and passing this to table_new() means we'd get a table with only two columns instead of three, leading up to a very confusing output: $ build/systemd-analyze pcrs System lacks full TPM2 support, not showing PCR state. NR NAME 0 platform-code - 1 platform-config - 2 external-code - 3 external-config - 4 boot-loader-code - 5 boot-loader-config - 6 - - 7 ... Let's name the header in this case with a simple dash, as it's going to be hidden anyway, to make the table nice again: $ build/systemd-analyze pcrs System lacks full TPM2 support, not showing PCR state. NR NAME 0 platform-code 1 platform-config 2 external-code 3 external-config 4 boot-loader-code 5 boot-loader-config 6 - 7 secure-boot-policy ... --- src/analyze/analyze-pcrs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/analyze/analyze-pcrs.c b/src/analyze/analyze-pcrs.c index 82f0f39288..c081ffef01 100644 --- a/src/analyze/analyze-pcrs.c +++ b/src/analyze/analyze-pcrs.c @@ -104,7 +104,7 @@ int verb_pcrs(int argc, char *argv[], void *userdata) { return r; } - table = table_new("nr", "name", alg); + table = table_new("nr", "name", alg ?: "-"); if (!table) return log_oom(); -- 2.25.1