Add bug checks into label file system operation methods (#774818)

Ensure pre-condition of never being passed a Partition object containing
an open LUKS encryption mapping is met for label file system operation
related methods.

Bug 774818 - Implement LUKS read-write actions NOT requiring a
             passphrase
This commit is contained in:
Mike Fleetwood 2016-12-03 20:06:44 +00:00 committed by Curtis Gedak
parent ff4ac89ba2
commit 49c0564601
1 changed files with 8 additions and 0 deletions

View File

@ -2146,6 +2146,14 @@ bool GParted_Core::remove_filesystem( const Partition & partition, OperationDeta
bool GParted_Core::label_filesystem( const Partition & partition, OperationDetail & operationdetail ) bool GParted_Core::label_filesystem( const Partition & partition, OperationDetail & operationdetail )
{ {
if ( partition.filesystem == FS_LUKS && partition.busy )
{
operationdetail.add_child( OperationDetail(
GPARTED_BUG + ": " + _("partition contains open LUKS encryption for a label file system only step"),
STATUS_ERROR, FONT_ITALIC ) );
return false;
}
if( partition.get_filesystem_label().empty() ) { if( partition.get_filesystem_label().empty() ) {
operationdetail.add_child( OperationDetail( operationdetail.add_child( OperationDetail(
String::ucompose( _("Clear file system label on %1"), partition.get_path() ) ) ); String::ucompose( _("Clear file system label on %1"), partition.get_path() ) ) );