summaryrefslogtreecommitdiff
path: root/gptcl.cc
diff options
context:
space:
mode:
authorRoderick W. Smith <rodsmith@rodsbooks.com>2015-10-18 15:56:31 -0400
committerRoderick W. Smith <rodsmith@rodsbooks.com>2015-10-18 15:56:31 -0400
commit6aec1dcf15f726b3049412418da59b6e2c882263 (patch)
treee8dfa65540110a1ba1ea9648b9baea171e95f86b /gptcl.cc
parent080ff55bc2d1b4d928b30159812033c31ae27ae5 (diff)
downloadsgdisk-6aec1dcf15f726b3049412418da59b6e2c882263.tar.gz
Fixed bug in sgdisk that caused --largest-new/-N to fail if fed a
value of "0" for the partition number. (This should work, according to the man page, and now it does.)
Diffstat (limited to 'gptcl.cc')
-rw-r--r--gptcl.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/gptcl.cc b/gptcl.cc
index 2044244..7c1d5cf 100644
--- a/gptcl.cc
+++ b/gptcl.cc
@@ -307,8 +307,8 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) {
startSector = FindFirstInLargest();
Align(&startSector);
endSector = FindLastInFree(startSector);
- if (largestPartNum < 0)
- largestPartNum = FindFirstFreePart();
+ if (largestPartNum <= 0)
+ largestPartNum = FindFirstFreePart() + 1;
if (CreatePartition(largestPartNum - 1, startSector, endSector)) {
saveData = 1;
} else {