From 0b164b168d28b63fb8dc6fcee4e16b1b6b2552c4 Mon Sep 17 00:00:00 2001 From: Mike Fleetwood Date: Sat, 2 Mar 2013 11:23:06 +0000 Subject: [PATCH] Make flush OS cache a reported step (#688882) As failure of flushing the cache can lead to misidentification of file systems make it a checked step in the displayed operation details. Bug #688882 - Improve clearing of file system signatures --- src/GParted_Core.cc | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc index a3c145ff..6e1c7589 100644 --- a/src/GParted_Core.cc +++ b/src/GParted_Core.cc @@ -3239,10 +3239,20 @@ bool GParted_Core::erase_filesystem_signatures( const Partition & partition, Ope // Opening the device and calling ped_device_sync() took 0.15 seconds or less on // a 5400 RPM laptop hard drive. For now just always call ped_device_sync() as // it doesn't add much time to the overall operation. - if ( device_is_open ) + if ( overall_success ) { - ped_device_sync( lp_device ) ; - ped_device_close( lp_device ) ; + OperationDetail & od = operationdetail .get_last_child() ; + od .add_child( OperationDetail( String::ucompose( _("flush operating system cache of %1"), + lp_device ->path ) ) ) ; + + bool flush_success = false ; + if ( device_is_open ) + { + flush_success = ped_device_sync( lp_device ) ; + ped_device_close( lp_device ) ; + } + od .get_last_child() .set_status( flush_success ? STATUS_SUCCES : STATUS_ERROR ) ; + overall_success &= flush_success ; } close_device_and_disk( lp_device, lp_disk ) ;