From: Frantisek Sumsal Date: Sat, 29 Jul 2023 19:04:44 +0000 (+0200) Subject: analyze: fix pcrs verb output without TPM support X-Git-Tag: v255-rc1~895 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9fe4e68cabaf79681388d025d86bd14f5ae944a6;p=thirdparty%2Fsystemd.git 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 ... --- diff --git a/src/analyze/analyze-pcrs.c b/src/analyze/analyze-pcrs.c index 82f0f392880..c081ffef017 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();