[gparted] Add bug checks into check operation methods (#774818)



commit 313c5fcb1ca11b4d5ec4e6902848e6d761fec5f9
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Sat Dec 3 20:10:06 2016 +0000

    Add bug checks into check operation methods (#774818)
    
    Ensure pre-condition of never being passed a Partition object containing
    an open LUKS encryption mapping is met for check operation related
    methods.
    
    Bug 774818 - Implement LUKS read-write actions NOT requiring a
                 passphrase

 src/GParted_Core.cc |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index 9c165ef..bd6dad7 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -2806,6 +2806,14 @@ bool GParted_Core::shrink_filesystem( const Partition & partition_old,
 
 bool GParted_Core::maximize_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 maximize file 
system only step"),
+                       STATUS_ERROR, FONT_ITALIC ) );
+               return false;
+       }
+
        operationdetail .add_child( OperationDetail( _("grow file system to fill the partition") ) ) ;
 
        // Checking if growing is available or allowed is only relevant for the check
@@ -3194,6 +3202,14 @@ void GParted_Core::rollback_transaction( const Partition & partition_src,
 
 bool GParted_Core::check_repair_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 check repair 
file system only step"),
+                       STATUS_ERROR, FONT_ITALIC ) );
+               return false;
+       }
+
        if ( partition.busy )
                // Trying to check an online file system is a successful non-operation.
                return true;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]