1
0
mirror of https://github.com/systemd/systemd.git synced 2025-02-03 17:47:28 +03:00

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
...
This commit is contained in:
Frantisek Sumsal 2023-07-29 21:04:44 +02:00 committed by Yu Watanabe
parent cbcf76b193
commit 9fe4e68cab

View File

@ -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();