]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tpm2-util: guarantee that verb_has_tpm2_generic() returns usable exit status 37690/head
authorLennart Poettering <lennart@poettering.net>
Tue, 3 Jun 2025 14:11:57 +0000 (16:11 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 3 Jun 2025 14:16:46 +0000 (16:16 +0200)
src/shared/tpm2-util.c

index e7bc86faa12de81902ffddd2d6ee1c0cf79cd8e1..1c1ce441a25422f3ef5bdac6d9158d38df2cfffc 100644 (file)
@@ -7842,6 +7842,8 @@ int verb_has_tpm2_generic(bool quiet) {
                 print_field("  ", "libtss2-mu.so.0", FLAGS_SET(s, TPM2_SUPPORT_LIBTSS2_MU));
         }
 
+        assert_cc(TPM2_SUPPORT_API <= 255); /* make sure this is safe to use as process exit status */
+
         /* Return inverted bit flags. So that TPM2_SUPPORT_FULL becomes EXIT_SUCCESS and the other values
          * become some reasonable values 1…7. i.e. the flags we return here tell what is missing rather than
          * what is there, acknowledging the fact that for process exit statuses it is customary to return