Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=fwsetup-ng.git;a=commitdiff;h=eff4c9bd5482242ad1e0455ce4afbc1f026add48

commit eff4c9bd5482242ad1e0455ce4afbc1f026add48
Author: James Buren <[email protected]>
Date:   Mon Aug 27 18:10:38 2012 -0500

fill in the primary table gaps with empty entries if they are unused.

diff --git a/DosPartitionTable.cc b/DosPartitionTable.cc
index 6d4487e..93b0891 100644
--- a/DosPartitionTable.cc
+++ b/DosPartitionTable.cc
@@ -111,6 +111,7 @@ bool DosPartitionTable::write(const string &path)
DosPartition *part = 0;
pid_t pid = -1;
int status = 0;
+  size_t prev = 0;

if(_table.empty())
return false;
@@ -123,6 +124,15 @@ bool DosPartitionTable::write(const string &path)
while(i < _table.size())
{
part = (DosPartition *) _table.at(i);
+    if((part->getNumber() - prev) > 1)
+    {
+      prev = part->getNumber() - prev;
+      while(prev > 1)
+      {
+        cmd << "0 0 0x0 -\\n";
+        --prev;
+      }
+    }
cmd << dec;
cmd << part->getStart();
cmd << " ";
@@ -134,6 +144,7 @@ bool DosPartitionTable::write(const string &path)
cmd << " ";
cmd << (part->getActive() ? "*" : "-");
cmd << "\\n";
+    prev = part->getNumber();
++i;
}
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to