Blame SOURCES/libkcapi-1.1.1-kcapi-hasher_Fix_command-line_parsing.patch

fe8dd0
From 912ab6d55ef5af594d22d01a39cf7e035c797335 Mon Sep 17 00:00:00 2001
fe8dd0
From: Ondrej Mosnacek <omosnace@redhat.com>
fe8dd0
Date: Wed, 11 Jul 2018 09:42:26 +0200
fe8dd0
Subject: [PATCH] kcapi-hasher: Fix command-line parsing
fe8dd0
fe8dd0
I made a mistake in commit 3be3e18d4a2e ("kcapi-hasher: Allow picking
fe8dd0
basename via cmdline"), which apparently broke command-line parsing when
fe8dd0
the '-n' options is not used. This patch fixes the issue by resetting
fe8dd0
the right variable and also silences error messages when checking for
fe8dd0
the '-n' option.
fe8dd0
fe8dd0
Fedora BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1599831
fe8dd0
---
fe8dd0
 apps/kcapi-hasher.c | 4 +++-
fe8dd0
 1 file changed, 3 insertions(+), 1 deletion(-)
fe8dd0
fe8dd0
diff --git a/apps/kcapi-hasher.c b/apps/kcapi-hasher.c
fe8dd0
index ae88211..90707a6 100644
fe8dd0
--- a/apps/kcapi-hasher.c
fe8dd0
+++ b/apps/kcapi-hasher.c
fe8dd0
@@ -841,10 +841,12 @@ int main(int argc, char *argv[])
fe8dd0
 	}
fe8dd0
 	basen = basename(basec);
fe8dd0
 
fe8dd0
+	opterr = 0;
fe8dd0
 	if (getopt_long(argc, argv, opts_name_short, opts_name, &opt_index) == 'n')
fe8dd0
 		basen = optarg;
fe8dd0
 	else
fe8dd0
-		opt_index = 0;
fe8dd0
+		optind = 1;
fe8dd0
+	opterr = 1;
fe8dd0
 
fe8dd0
 	params_self = &PARAMS_SELF_FIPSCHECK;
fe8dd0
 	if (0 == strncmp(basen, "sha256sum", 9)) {