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

Unified Diff: cgpt/cmd_add.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
« cgpt/cgpt_common.c ('K') | « cgpt/cgpt_common.c ('k') | cgpt/cmd_boot.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cgpt/cmd_add.c
diff --git a/cgpt/cmd_add.c b/cgpt/cmd_add.c
index 21085e71444a8fd896e697791356cf2b21ef7e91..c0fd9fe650fff9a680553f1253549e5d1af3af3a 100644
--- a/cgpt/cmd_add.c
+++ b/cgpt/cmd_add.c
@@ -198,6 +198,13 @@ int cmd_add(int argc, char *argv[]) {
return CGPT_FAILED;
}
+ if ((drive.gpt.valid_headers != MASK_BOTH) ||
Hung-Te 2010/11/17 10:37:04 it looks a little weird for me to compare a variab
Louis 2010/11/18 01:51:29 Good catch. Modified as: (valid_header & MASK_BO
+ (drive.gpt.valid_entries != MASK_BOTH)) {
+ Error("one of the GPT header/entries is invalid.\n"
+ "please run 'cgpt repair' before adding anything.\n");
+ return CGPT_FAILED;
+ }
+
uint32_t max_part = GetNumberOfEntries(&drive.gpt);
if (partition) {
if (partition > max_part) {
« cgpt/cgpt_common.c ('K') | « cgpt/cgpt_common.c ('k') | cgpt/cmd_boot.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698