X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FApplication%2FCapsuleApp%2FCapsuleApp.c;fp=MdeModulePkg%2FApplication%2FCapsuleApp%2FCapsuleApp.c;h=0b5f7c86841808a18d7805ddb5375b5d507a739e;hp=e3c591dbf3c822c8127d8e09a28f4f5dcbc5ac01;hb=6470a43160183cd48cad8901c912a48811f18b13;hpb=0d4aa276d1f6e0cb9d71a7fb88b30c416ba6d5a3 diff --git a/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c b/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c index e3c591dbf3..0b5f7c8684 100644 --- a/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c +++ b/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c @@ -849,7 +849,7 @@ PrintUsage ( Print(L"Parameter:\n"); Print(L" -NR: No reset will be triggered for the capsule\n"); Print(L" with CAPSULE_FLAGS_PERSIST_ACROSS_RESET and without CAPSULE_FLAGS_INITIATE_RESET.\n"); - Print(L" -OD: Delivery of Capsules via file on Mass Storage device."); + Print(L" -OD: Delivery of Capsules via file on Mass Storage device.\n"); Print(L" -S: Dump capsule report variable (EFI_CAPSULE_REPORT_GUID),\n"); Print(L" which is defined in UEFI specification.\n"); Print(L" -C: Clear capsule report variable (EFI_CAPSULE_REPORT_GUID),\n"); @@ -1020,40 +1020,39 @@ UefiMain ( } } - if (ParaOdIndex != 0) { - if (ParaOdIndex == Argc - 1) { + if (ParaOdIndex > ParaNrIndex) { + if (ParaNrIndex != 0) { + CapsuleLastIndex = ParaNrIndex - 1; + } else { + CapsuleLastIndex = ParaOdIndex - 1; + } + + if (ParaOdIndex == Argc -1) { MapFsStr = NULL; } else if (ParaOdIndex == Argc - 2) { MapFsStr = Argv[Argc-1]; } else { - Print (L"CapsuleApp: Invalid Position for -OD Options\n"); + Print (L"CapsuleApp: Cannot specify more than one FS mapping!\n"); Status = EFI_INVALID_PARAMETER; goto Done; } - - if (ParaNrIndex != 0) { - if (ParaNrIndex + 1 == ParaOdIndex) { - CapsuleLastIndex = ParaNrIndex - 1; - } else { - Print (L"CapsuleApp: Invalid Position for -NR Options\n"); - Status = EFI_INVALID_PARAMETER; - goto Done; - } - } else { + } else if (ParaOdIndex < ParaNrIndex) { + if (ParaOdIndex != 0) { CapsuleLastIndex = ParaOdIndex - 1; - } - } else { - if (ParaNrIndex != 0) { - if (ParaNrIndex == Argc -1) { - CapsuleLastIndex = ParaNrIndex - 1; + if (ParaOdIndex == ParaNrIndex - 1) { + MapFsStr = NULL; + } else if (ParaOdIndex == ParaNrIndex - 2) { + MapFsStr = Argv[ParaOdIndex + 1]; } else { - Print (L"CapsuleApp: Invalid Position for -NR Options\n"); + Print (L"CapsuleApp: Cannot specify more than one FS mapping!\n"); Status = EFI_INVALID_PARAMETER; goto Done; } } else { - CapsuleLastIndex = Argc - 1; + CapsuleLastIndex = ParaNrIndex - 1; } + } else { + CapsuleLastIndex = Argc - 1; } CapsuleNum = CapsuleLastIndex - CapsuleFirstIndex + 1;