Add bug checks into copy operation methods (#774818)

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

Bug 774818 - Implement LUKS read-write actions NOT requiring a
             passphrase
This commit is contained in:
Mike Fleetwood 2016-12-04 10:47:18 +00:00 committed by Curtis Gedak
parent e31fa783a8
commit 89540fedd8
1 changed files with 15 additions and 0 deletions

View File

@ -3013,6 +3013,21 @@ bool GParted_Core::copy_filesystem( const Partition & partition_src,
Partition & partition_dst, Partition & partition_dst,
OperationDetail & operationdetail ) OperationDetail & operationdetail )
{ {
if ( partition_src.filesystem == FS_LUKS && partition_src.busy )
{
operationdetail.add_child( OperationDetail(
GPARTED_BUG + ": " + _("source partition contains open LUKS encryption for a file system copy only step"),
STATUS_ERROR, FONT_ITALIC ) );
return false;
}
if ( partition_dst.filesystem == FS_LUKS && partition_dst.busy )
{
operationdetail.add_child( OperationDetail(
GPARTED_BUG + ": " + _("destination partition contains open LUKS encryption for a file system copy only step"),
STATUS_ERROR, FONT_ITALIC ) );
return false;
}
operationdetail.add_child( OperationDetail( operationdetail.add_child( OperationDetail(
String::ucompose( _("copy file system from %1 to %2"), String::ucompose( _("copy file system from %1 to %2"),
partition_src.get_path(), partition_src.get_path(),