Commit partition table when closing Sfdisk backend device.

This commit is contained in:
Andrius Štikonas 2017-12-25 00:11:13 +00:00
parent 41570fde5d
commit 590b531863
1 changed files with 6 additions and 8 deletions

View File

@ -31,6 +31,7 @@ SfdiskDevice::SfdiskDevice(const Device& d) :
SfdiskDevice::~SfdiskDevice()
{
close();
}
bool SfdiskDevice::open()
@ -50,19 +51,16 @@ bool SfdiskDevice::close()
if (isExclusive())
setExclusive(false);
CoreBackendPartitionTable* ptable = new SfdiskPartitionTable(m_device);
ptable->commit();
delete ptable;
return true;
}
CoreBackendPartitionTable* SfdiskDevice::openPartitionTable()
{
CoreBackendPartitionTable* ptable = new SfdiskPartitionTable(m_device);
if (ptable == nullptr || !ptable->open()) {
delete ptable;
ptable = nullptr;
}
return ptable;
return new SfdiskPartitionTable(m_device);
}
bool SfdiskDevice::createPartitionTable(Report& report, const PartitionTable& ptable)