summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kexec/kexec.c12
1 files 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,