]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tpm2-setup: use symbolic exit code
authorLennart Poettering <lennart@amutable.com>
Tue, 3 Mar 2026 20:50:49 +0000 (21:50 +0100)
committerLennart Poettering <lennart@amutable.com>
Wed, 4 Mar 2026 07:28:46 +0000 (08:28 +0100)
76 is the bsd exit code EX_PROTOCOL, which is kinda fitting here. Let#s
hence use the symbolic exit code here.

src/tpm2-setup/tpm2-setup.c
units/systemd-tpm2-setup-early.service.in
units/systemd-tpm2-setup.service.in

index cfb118f6acf15bb44d57a9dc3b1ff8c0b74608f1..3eed095d2260c5fcbaec94957a4c45eb1882e1b8 100644 (file)
@@ -2,6 +2,7 @@
 
 #include <getopt.h>
 #include <sys/stat.h>
+#include <sysexits.h>
 
 #include "sd-messages.h"
 
@@ -291,8 +292,8 @@ static int setup_srk(void) {
                 log_struct_errno(LOG_INFO, r,
                                  LOG_MESSAGE("Insufficient permissions to access TPM, not generating SRK."),
                                  LOG_MESSAGE_ID(SD_MESSAGE_SRK_ENROLLMENT_NEEDS_AUTHORIZATION_STR));
-                return 76; /* Special return value which means "Insufficient permissions to access TPM,
-                            * cannot generate SRK". This isn't really an error when called at boot. */;
+                return EX_PROTOCOL; /* Special return value which means "Insufficient permissions to access TPM,
+                                     * cannot generate SRK". This isn't really an error when called at boot. */;
         }
         if (r < 0)
                 return r;
index 7fdb99b53f36a085059f3bc1873f55b1e0fd80b0..bd69c9de7a5e1323e5535c3020c3eab7f8871d41 100644 (file)
@@ -22,5 +22,5 @@ Type=oneshot
 RemainAfterExit=yes
 ExecStart={{LIBEXECDIR}}/systemd-tpm2-setup --early=yes --graceful
 
-# The tool returns 76 if the TPM cannot be accessed due to an authorization failure and we can't generate an SRK.
-SuccessExitStatus=76
+# The tool returns EX_PROTOCOL if the TPM cannot be accessed due to an authorization failure and we can't generate an SRK.
+SuccessExitStatus=PROTOCOL
index 34404a24cb5e140cb5e867f71f2baaa9e9782374..a81b028214034d9ee5d08d9e20e83582f6104186 100644 (file)
@@ -23,5 +23,5 @@ Type=oneshot
 RemainAfterExit=yes
 ExecStart={{LIBEXECDIR}}/systemd-tpm2-setup --graceful
 
-# The tool returns 76 if the TPM cannot be accessed due to an authorization failure and we can't generate an SRK.
-SuccessExitStatus=76
+# The tool returns EX_PROTOCOL if the TPM cannot be accessed due to an authorization failure and we can't generate an SRK.
+SuccessExitStatus=PROTOCOL