Fix abort on unknown argument

Resolves: #2087066
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
This commit is contained in:
Robbie Harwood 2022-05-23 18:43:41 +00:00
parent d983f1b2ef
commit 2e88844273
3 changed files with 38 additions and 1 deletions

View File

@ -0,0 +1,31 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Robbie Harwood <rharwood@redhat.com>
Date: Tue, 17 May 2022 11:23:28 -0400
Subject: [PATCH] Show usage instead of aborting on bad flags
Aborting here just confuses users and is sufficiently unexpected to
cause the filing of bugs.
Related: https://bugzilla.redhat.com/show_bug.cgi?id=2087066
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
(cherry picked from commit 82694cb1ce3b29c3705c25ae4cea3d07fe57b558)
---
src/mokutil.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/mokutil.c b/src/mokutil.c
index 5d725c9..e8228af 100644
--- a/src/mokutil.c
+++ b/src/mokutil.c
@@ -2087,10 +2087,9 @@ main (int argc, char *argv[])
goto out;
case 'h':
case '?':
+ default:
command |= HELP;
break;
- default:
- abort ();
}
}

1
mokutil.patches Normal file
View File

@ -0,0 +1 @@
Patch0001: 0001-Show-usage-instead-of-aborting-on-bad-flags.patch

View File

@ -1,11 +1,12 @@
Name: mokutil
Version: 0.6.0
Release: 1%{?dist}
Release: 2%{?dist}
Epoch: 2
Summary: Tool to manage UEFI Secure Boot MoK Keys
License: GPLv3+
URL: https://github.com/lcp/mokutil
Source0: https://github.com/lcp/mokutil/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1: mokutil.patches
ExclusiveArch: %{ix86} x86_64 aarch64 %{arm}
BuildRequires: autoconf
@ -43,6 +44,10 @@ mokutil provides a tool to manage keys for Secure Boot through the MoK
%{_datadir}/bash-completion/completions/mokutil
%changelog
* Mon May 23 2022 Robbie Harwood <rharwood@redhat.com> - 2:0.6.0-2
- Fix abort on unknown argument
- Resolves: #2087066
* Sat May 07 2022 Peter Robinson <pbrobinson@fedoraproject.org> - 2:0.6.0-1
- Update to 0.6.0 release