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

commit c089286802d816313e00a82ad920e9be8c8e89bc
Author: James Buren <[email protected]>
Date:   Sun Aug 26 19:56:29 2012 -0500

First, disable check for physical disks on write temporaily.
Second, truncate partition size to the very last sector if it goes over.
Third, reject a request for a new partition if there's no usable space left.

diff --git a/Device.cc b/Device.cc
index 8a246aa..d3cd5c6 100644
--- a/Device.cc
+++ b/Device.cc
@@ -216,7 +216,8 @@ bail:

bool Device::write()
{
-  if(!_initialized || !_disk || _table == 0 || _table->getTableSize() == 0)
+  // TODO: block writes on non-physical devices
+  if(!_initialized || _table == 0 || _table->getTableSize() == 0)
return false;

return _table->write(_path);
@@ -285,9 +286,12 @@ Partition *Device::newPartition(unsigned long long size)

part->setEnd(alignUp(part->getEnd()) - 1);

+  if(part->getEnd() > usable_sectors)
+    part->setEnd(usable_sectors - 1);
+
part->setSectors(part->getEnd() - part->getStart() + 1);

-  if(part->getSectors() > (usable_sectors - part->getStart()))
+  if(part->getStart() > usable_sectors)
{
delete part;
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to