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) { |