diff options
author | srs5694 <srs5694@users.sourceforge.net> | 2010-10-07 13:00:45 -0400 |
---|---|---|
committer | srs5694 <srs5694@users.sourceforge.net> | 2010-10-07 13:00:45 -0400 |
commit | 0873e9d0e9345a2c4418b4718db525c9f1111c83 (patch) | |
tree | 4c6b2adf5d20e0bce392eb2cf0ebc47801d9495b /sgdisk.cc | |
parent | ab4b0438394df4ae6bdea86194e254d7d35fdea0 (diff) | |
download | sgdisk-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.cc | 34 |
1 files changed, 20 insertions, 14 deletions
@@ -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': |