Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(403)

Unified Diff: cgpt/cmd_show.c

Issue 5115002: Fixing the bug of CGPT when primary entry table is invalid. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/vboot_reference.git
Patch Set: Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cgpt/cmd_show.c
diff --git a/cgpt/cmd_show.c b/cgpt/cmd_show.c
index a9963b5b1e7582fce7cc1f52566cc46b7194a2dd..920a30fe6fe63843d8edaa672d5b562354983d07 100644
--- a/cgpt/cmd_show.c
+++ b/cgpt/cmd_show.c
@@ -274,7 +274,7 @@ int cmd_show(int argc, char *argv[]) {
}
uint32_t index = partition - 1;
- GptEntry *entry = GetEntry(&drive.gpt, PRIMARY, index);
+ GptEntry *entry = GetEntry(&drive.gpt, ANY_VALID, index);
char buf[256]; // scratch buffer for string conversion
if (single_item) {
@@ -299,13 +299,13 @@ int cmd_show(int argc, char *argv[]) {
printf("%s\n", buf);
break;
case 'S':
- printf("%d\n", GetSuccessful(&drive.gpt, PRIMARY, index));
+ printf("%d\n", GetSuccessful(&drive.gpt, ANY_VALID, index));
break;
case 'T':
- printf("%d\n", GetTries(&drive.gpt, PRIMARY, index));
+ printf("%d\n", GetTries(&drive.gpt, ANY_VALID, index));
break;
case 'P':
- printf("%d\n", GetPriority(&drive.gpt, PRIMARY, index));
+ printf("%d\n", GetPriority(&drive.gpt, ANY_VALID, index));
break;
case 'A':
printf("0x%x\n", entry->attrs.fields.gpt_att);
@@ -322,7 +322,7 @@ int cmd_show(int argc, char *argv[]) {
char type[GUID_STRLEN];
for (i = 0; i < GetNumberOfEntries(&drive.gpt); ++i) {
- entry = GetEntry(&drive.gpt, PRIMARY, i);
+ entry = GetEntry(&drive.gpt, ANY_VALID, i);
if (IsZero(&entry->type))
continue;

Powered by Google App Engine
This is Rietveld 408576698