[gparted] Prevent file system grow when partition grow fails (#686668)



commit fd963289201532f2216029ffd1e0b49e22d79560
Author: Curtis Gedak <gedakc gmail com>
Date:   Sun Nov 25 13:20:56 2012 -0700

    Prevent file system grow when partition grow fails (#686668)
    
    Prior to this enhancement, GParted ignored the status of the partition
    grow operation, and attempted to grow the file system.
    
    Now we check the status of the partition grow operation prior to
    growing the file system.
    
    Part of Bug #686668 - Growing logical partition overlaps end of
                          extended partition

 src/GParted_Core.cc |   18 ++++++++----------
 1 files changed, 8 insertions(+), 10 deletions(-)
---
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index b3e72bd..631ea2f 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -2246,20 +2246,18 @@ bool GParted_Core::resize( const Partition & partition_old,
 			succes = resize_move_partition( partition_old, partition_new, operationdetail ) ;
 
 		//expand file system to fit exactly in partition
-		if ( ! (   //Do not maximize file system if FS not linux-swap and new size <= old
-		           (   partition_new .filesystem != FS_LINUX_SWAP  //linux-swap is recreated, not resized
-		            && partition_new .get_sector_length() <= partition_old .get_sector_length()
-		           )
-		        || (   check_repair_filesystem( partition_new, operationdetail )
-		            && maximize_filesystem( partition_new, operationdetail )
-		           )
+		if (   succes
+		    && (   //Maximize file system if FS not linux-swap and new size > old
+		           partition_new .filesystem != FS_LINUX_SWAP  //linux-swap is recreated, not resized
+		        && partition_new .get_sector_length() > partition_old .get_sector_length()
 		       )
 		   )
-			succes = false ;
-			
+			succes =    check_repair_filesystem( partition_new, operationdetail )
+			         && maximize_filesystem( partition_new, operationdetail ) ;
+
 		return succes ;
 	}
-		
+
 	return false ;
 }
 



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