diff options
author | Roderick W. Smith <rodsmith@rodsbooks.com> | 2014-02-20 13:25:22 -0500 |
---|---|---|
committer | Roderick W. Smith <rodsmith@rodsbooks.com> | 2014-02-20 13:25:22 -0500 |
commit | 820d1d04a3a76fb7699063597aac55742cc28d4a (patch) | |
tree | 2078e5dc1075c4ca4e402d43a3dc0918b872d0eb /gptcl.cc | |
parent | 9b338c50f298d04f47205f7fad082d8c21797ed7 (diff) | |
download | sgdisk-820d1d04a3a76fb7699063597aac55742cc28d4a.tar.gz |
Fixed sgdisk problem when creating hybrid MBR with a partition that
ends beyond sector 2^32. Now refuses to create such partitions.
Diffstat (limited to 'gptcl.cc')
-rw-r--r-- | gptcl.cc | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -1,7 +1,7 @@ /* Implementation of GPTData class derivative with popt-based command line processing - Copyright (C) 2010-2013 Roderick W. Smith + Copyright (C) 2010-2014 Roderick W. Smith This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -467,14 +467,14 @@ int GPTDataCL::BuildMBR(char* argument, int isHybrid) { int numParts, allOK = 1, i, origPartNum; MBRPart newPart; BasicMBRData newMBR; - + if (argument != NULL) { numParts = CountColons(argument) + 1; if (numParts <= (4 - isHybrid)) { newMBR.SetDisk(GetDisk()); for (i = 0; i < numParts; i++) { origPartNum = GetInt(argument, i + 1) - 1; - if (IsUsedPartNum(origPartNum)) { + if (IsUsedPartNum(origPartNum) && partitions[origPartNum].IsSizedForMBR()) { newPart.SetInclusion(PRIMARY); newPart.SetLocation(operator[](origPartNum).GetFirstLBA(), operator[](origPartNum).GetLengthLBA()); @@ -482,7 +482,7 @@ int GPTDataCL::BuildMBR(char* argument, int isHybrid) { newPart.SetType((uint8_t)(operator[](origPartNum).GetHexType() / 0x0100)); newMBR.AddPart(i + isHybrid, newPart); } else { - cerr << "Partition " << origPartNum << " does not exist! Aborting operation!\n"; + cerr << "Original partition " << origPartNum + 1 << " does not exist or is too big! Aborting operation!\n"; allOK = 0; } // if/else } // for |