tpm2-setup: use symbolic exit code

76 is the bsd exit code EX_PROTOCOL, which is kinda fitting here. Let#s
hence use the symbolic exit code here.
This commit is contained in:
Lennart Poettering
2026-03-04 08:28:46 +01:00
parent 9c8a2e53d3
commit 3dc670901e
3 changed files with 7 additions and 6 deletions
+3 -2
View 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;
+2 -2
View 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
+2 -2
View 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