summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cgpt/cgpt_add.c6
-rw-r--r--cgpt/cgpt_prioritize.c5
2 files changed, 7 insertions, 4 deletions
diff --git a/cgpt/cgpt_add.c b/cgpt/cgpt_add.c
index 4e0506e9..5ac50677 100644
--- a/cgpt/cgpt_add.c
+++ b/cgpt/cgpt_add.c
@@ -138,10 +138,8 @@ static int CgptCheckAddValidity(struct drive *drive) {
return -1;
}
- if (((drive->gpt.valid_headers & MASK_BOTH) != MASK_BOTH) ||
- ((drive->gpt.valid_entries & MASK_BOTH) != MASK_BOTH)) {
- Error("one of the GPT header/entries is invalid.\n"
- "please run 'cgpt repair' before adding anything.\n");
+ if (CGPT_OK != CheckValid(drive)) {
+ Error("please run 'cgpt repair' before adding anything.\n");
return -1;
}
diff --git a/cgpt/cgpt_prioritize.c b/cgpt/cgpt_prioritize.c
index 2bfc4843..c4e812c2 100644
--- a/cgpt/cgpt_prioritize.c
+++ b/cgpt/cgpt_prioritize.c
@@ -116,6 +116,11 @@ int CgptPrioritize(CgptPrioritizeParams *params) {
return CGPT_FAILED;
}
+ if (CGPT_OK != CheckValid(&drive)) {
+ Error("please run 'cgpt repair' before reordering the priority.\n");
+ return CGPT_OK;
+ }
+
max_part = GetNumberOfEntries(&drive);
if (params->set_partition) {