summaryrefslogtreecommitdiff
path: root/sgdisk.cc
diff options
context:
space:
mode:
authorsrs5694 <srs5694@users.sourceforge.net>2010-10-07 13:00:45 -0400
committersrs5694 <srs5694@users.sourceforge.net>2010-10-07 13:00:45 -0400
commit0873e9d0e9345a2c4418b4718db525c9f1111c83 (patch)
tree4c6b2adf5d20e0bce392eb2cf0ebc47801d9495b /sgdisk.cc
parentab4b0438394df4ae6bdea86194e254d7d35fdea0 (diff)
downloadsgdisk-0873e9d0e9345a2c4418b4718db525c9f1111c83.tar.gz
Version 0.6.12 release; mostly changes in support for disks with other
than 512-byte sectors.
Diffstat (limited to 'sgdisk.cc')
-rw-r--r--sgdisk.cc34
1 files changed, 20 insertions, 14 deletions
diff --git a/sgdisk.cc b/sgdisk.cc
index 7b88f71..b0959a5 100644
--- a/sgdisk.cc
+++ b/sgdisk.cc
@@ -136,20 +136,26 @@ int main(int argc, char *argv[]) {
case 'A': {
if (cmd != "list") {
partNum = (int) GetInt(attributeOperation, 1) - 1;
- switch (theGPT.ManageAttributes(partNum, GetString(attributeOperation, 2),
- GetString(attributeOperation, 3))) {
- case -1:
- saveData = 0;
- neverSaveData = 1;
- break;
- case 1:
- theGPT.JustLooking(0);
- saveData = 1;
- break;
- default:
- break;
- } // switch
- } // if
+ if ((partNum >= 0) && (partNum < (int) theGPT.GetNumParts())) {
+ switch (theGPT.ManageAttributes(partNum, GetString(attributeOperation, 2),
+ GetString(attributeOperation, 3))) {
+ case -1:
+ saveData = 0;
+ neverSaveData = 1;
+ break;
+ case 1:
+ theGPT.JustLooking(0);
+ saveData = 1;
+ break;
+ default:
+ break;
+ } // switch
+ } else {
+ cerr << "Error: Invalid partition number " << partNum + 1 << "\n";
+ saveData = 0;
+ neverSaveData = 1;
+ } // if/else reasonable partition #
+ } // if (cmd != "list")
break;
} // case 'A':
case 'a':