Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP2:Update
kexec-tools
kexec-tools-reset-getopt-before-falling-back-to...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File kexec-tools-reset-getopt-before-falling-back-to-legacy.patch of Package kexec-tools
From dadafc4664c7b78ea1561ccca33986c9639106ec Mon Sep 17 00:00:00 2001 From: Petr Tesarik <ptesarik@suse.com> Date: Fri, 13 Mar 2020 14:54:00 +0100 Upstream: not yet, patch sent 2020-03-13 Subject: Reset getopt before falling back to legacy syscall References: bsc#1166105 The modules may need to parse the arguments again after kexec_file_load(2) failed, but getopt is not reset. This change fixes the --initrd option on s390x. Without this patch, it will fail to load the initrd on kernels that do not implement kexec_file_load(2). Signed-off-by: Petr Tesarik <ptesarik@suse.com> --- kexec/kexec.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/kexec/kexec.c b/kexec/kexec.c index 33c1b4b..6601f1f 100644 --- a/kexec/kexec.c +++ b/kexec/kexec.c @@ -1538,8 +1538,12 @@ int main(int argc, char *argv[]) if (do_unload) { if (do_kexec_file_syscall) { result = kexec_file_unload(kexec_file_flags); - if (result == EFALLBACK && do_kexec_fallback) + if (result == EFALLBACK && do_kexec_fallback) { + /* Reset getopt for fallback */ + opterr = 1; + optind = 1; do_kexec_file_syscall = 0; + } } if (!do_kexec_file_syscall) result = k_unload(kexec_flags); @@ -1548,8 +1552,12 @@ int main(int argc, char *argv[]) if (do_kexec_file_syscall) { result = do_kexec_file_load(fileind, argc, argv, kexec_file_flags); - if (result == EFALLBACK && do_kexec_fallback) + if (result == EFALLBACK && do_kexec_fallback) { + /* Reset getopt for fallback */ + opterr = 1; + optind = 1; do_kexec_file_syscall = 0; + } } if (!do_kexec_file_syscall) result = my_load(type, fileind, argc, argv, -- 2.16.4
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor