mokutil/0004-mokutil.c-on-test-key-return-non-zero-if-test-key-is.patch
Leo Sandoval 853ac02b9c Better return codes
Introduce --is-sb-enabled parameter and better return codes. Also show
help on unsupported systems.

Resolves: #RHEL-90836
Resolves: #RHEL-90839
Signed-off-by: Leo Sandoval <lsandova@redhat.com>
2025-05-12 12:34:01 -06:00

28 lines
902 B
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Leo Sandoval <lsandova@redhat.com>
Date: Thu, 24 Apr 2025 12:49:29 -0600
Subject: [PATCH] mokutil.c: on --test-key, return non-zero if test key is not
enrolled
Aligns with the same behaviour as other common UNIX tools,
e.g. 'command -v program' returns 0 if program exists, non-zero if not
Signed-off-by: Leo Sandoval <lsandova@redhat.com>
---
src/mokutil.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/mokutil.c b/src/mokutil.c
index 988b060..e40579b 100644
--- a/src/mokutil.c
+++ b/src/mokutil.c
@@ -1567,7 +1567,7 @@ test_key (const MokRequest req, const char *key_file)
if (is_valid_request (&efi_guid_x509_cert, key, read_size, req)) {
printf ("%s is not enrolled\n", key_file);
- ret = 0;
+ ret = 1;
} else {
print_skip_message (key_file, key, read_size, req);
ret = 1;