From 3ba06ea301864e1918054dcd0e2ac614de97581b Mon Sep 17 00:00:00 2001 From: Bart Hakvoort Date: Sat, 18 Feb 2006 16:03:29 +0000 Subject: [PATCH] added some checks before performing a move/resize using libparted. * src/GParted_Core.cc: added some checks before performing a move/resize using libparted. --- ChangeLog | 5 +++++ src/GParted_Core.cc | 26 +++++++++++++++++++------- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index a840c12c..9a3ec10b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-02-18 Bart Hakvoort + + * src/GParted_Core.cc: added some checks before performing a + move/resize using libparted. + 2006-02-18 Bart Hakvoort * src/Win_GParted.cc: added shortcut to menuitem diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc index bcb29f15..8dc4ff21 100644 --- a/src/GParted_Core.cc +++ b/src/GParted_Core.cc @@ -609,15 +609,25 @@ bool GParted_Core::resize( const Device & device, if ( partition_old .type == GParted::TYPE_EXTENDED ) return resize_container_partition( partition_old, partition_new, false, operation_details ) ; - //resize using libparted.. - //FIXME: let's add some checks before and after calling resize_normal_using_libparted() - if ( get_fs( partition_old .filesystem ) .grow == GParted::FS::LIBPARTED ) - return resize_normal_using_libparted( partition_old, partition_new, operation_details ) ; - - //use custom resize tools.. bool succes = false ; set_proper_filesystem( partition_new .filesystem ) ; + + //resize using libparted.. + if ( get_fs( partition_old .filesystem ) .grow == GParted::FS::LIBPARTED ) + { + if ( p_filesystem && p_filesystem ->Check_Repair( partition_new, operation_details ) ) + { + succes = resize_normal_using_libparted( partition_old, partition_new, operation_details ) ; + //always check after a resize, but if it failes the whole operation failes + if ( ! p_filesystem ->Check_Repair( partition_new, operation_details ) ) + succes = false ; + } + + return succes ; + } + + //use custom resize tools.. if ( p_filesystem && p_filesystem ->Check_Repair( partition_new, operation_details ) ) { succes = true ; @@ -645,9 +655,11 @@ bool GParted_Core::resize( const Device & device, if ( ! p_filesystem ->Check_Repair( partition_new, operation_details ) ) succes = false ; + + return succes ; } - return succes ; + return false ; } bool GParted_Core::copy( const Glib::ustring & src_part_path,