diff --git a/include/FileSystem.h b/include/FileSystem.h index 5c72fbf5..642e29ce 100644 --- a/include/FileSystem.h +++ b/include/FileSystem.h @@ -31,13 +31,11 @@ namespace GParted enum ExecFlags { EXEC_NONE = 1 << 0, - EXEC_CHECK_STATUS = 1 << 1, // Time and check exit status of the command in - // operation details. Only used when multiple - // commands are executed in the same file system - // specific action method. (GParted_Core displays - // the time and success of each action method in the - // parent operation detail so don't bother for single - // command file system action methods). + EXEC_CHECK_STATUS = 1 << 1, // Set the status of the command in the operation + // details based on the exit status being zero or + // non-zero. Must either use this flag when calling + // ::execute_command() or call ::set_status() + // afterwards. EXEC_CANCEL_SAFE = 1 << 2 }; @@ -80,6 +78,7 @@ public: protected: int execute_command( const Glib::ustring & command, OperationDetail & operationdetail, ExecFlags flags = EXEC_NONE ); + void set_status( OperationDetail & operationdetail, bool success ); void execute_command_eof(); Glib::ustring mk_temp_dir( const Glib::ustring & infix, OperationDetail & operationdetail ) ; void rm_temp_dir( const Glib::ustring dir_name, OperationDetail & operationdetail ) ; diff --git a/src/FileSystem.cc b/src/FileSystem.cc index a63d6881..6bd0c551 100644 --- a/src/FileSystem.cc +++ b/src/FileSystem.cc @@ -82,9 +82,7 @@ static void setup_child() int FileSystem::execute_command( const Glib::ustring & command, OperationDetail & operationdetail, ExecFlags flags ) { - operationdetail.add_child( OperationDetail( command, - ( flags & EXEC_CHECK_STATUS ) ? STATUS_EXECUTE : STATUS_NONE, - FONT_BOLD_ITALIC ) ); + operationdetail.add_child( OperationDetail( command, STATUS_EXECUTE, FONT_BOLD_ITALIC ) ); Glib::Pid pid; // set up pipes for capture int out, err; @@ -149,6 +147,11 @@ int FileSystem::execute_command( const Glib::ustring & command, OperationDetail return exit_status; } +void FileSystem::set_status( OperationDetail & operationdetail, bool success ) +{ + operationdetail.get_last_child().set_status( success ? STATUS_SUCCES : STATUS_ERROR ); +} + void FileSystem::execute_command_eof() { if (--pipecount) diff --git a/src/btrfs.cc b/src/btrfs.cc index 360ca231..522f7e47 100644 --- a/src/btrfs.cc +++ b/src/btrfs.cc @@ -154,12 +154,13 @@ bool btrfs::is_busy( const Glib::ustring & path ) bool btrfs::create( const Partition & new_partition, OperationDetail & operationdetail ) { return ! execute_command( "mkfs.btrfs -L \"" + new_partition.get_filesystem_label() + "\" " + - new_partition.get_path(), operationdetail ); + new_partition.get_path(), + operationdetail, EXEC_CHECK_STATUS ); } bool btrfs::check_repair( const Partition & partition, OperationDetail & operationdetail ) { - return (! execute_command( "btrfsck " + partition .get_path(), operationdetail )) ; + return ! execute_command( "btrfsck " + partition .get_path(), operationdetail, EXEC_CHECK_STATUS ); } void btrfs::set_used_sectors( Partition & partition ) @@ -294,7 +295,8 @@ void btrfs::set_used_sectors( Partition & partition ) bool btrfs::write_label( const Partition & partition, OperationDetail & operationdetail ) { return ! execute_command( "btrfs filesystem label " + partition.get_path() + - " \"" + partition.get_filesystem_label() + "\"", operationdetail ); + " \"" + partition.get_filesystem_label() + "\"", + operationdetail, EXEC_CHECK_STATUS ); } bool btrfs::resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition ) @@ -336,7 +338,7 @@ bool btrfs::resize( const Partition & partition_new, OperationDetail & operation cmd = "btrfs filesystem resize " + devid_str + ":" + size + " " + mount_point ; else cmd = "btrfsctl -r " + devid_str + ":" + size + " " + mount_point ; - exit_status = execute_command( cmd, operationdetail, EXEC_NONE ); + exit_status = execute_command( cmd, operationdetail ); bool resize_succeeded = ( exit_status == 0 ) ; if ( resize_to_same_size_fails ) { @@ -358,7 +360,7 @@ bool btrfs::resize( const Partition & partition_new, OperationDetail & operation || ( ! btrfs_found && exit_status == 1<<8 ) ) ; } - operationdetail .get_last_child() .set_status( resize_succeeded ? STATUS_SUCCES : STATUS_ERROR ) ; + set_status( operationdetail, resize_succeeded ); success &= resize_succeeded ; if ( ! partition_new .busy ) @@ -432,7 +434,7 @@ void btrfs::read_uuid( Partition & partition ) bool btrfs::write_uuid( const Partition & partition, OperationDetail & operationdetail ) { - return ! execute_command( "btrfstune -f -u " + partition.get_path(), operationdetail ); + return ! execute_command( "btrfstune -f -u " + partition.get_path(), operationdetail, EXEC_CHECK_STATUS ); } void btrfs::clear_cache() diff --git a/src/ext2.cc b/src/ext2.cc index e4a3f647..fb96c162 100644 --- a/src/ext2.cc +++ b/src/ext2.cc @@ -192,7 +192,8 @@ void ext2::read_label( Partition & partition ) bool ext2::write_label( const Partition & partition, OperationDetail & operationdetail ) { return ! execute_command( label_cmd + " " + partition.get_path() + - " \"" + partition.get_filesystem_label() + "\"", operationdetail ) ; + " \"" + partition.get_filesystem_label() + "\"", + operationdetail, EXEC_CHECK_STATUS ); } void ext2::read_uuid( Partition & partition ) @@ -213,14 +214,15 @@ void ext2::read_uuid( Partition & partition ) bool ext2::write_uuid( const Partition & partition, OperationDetail & operationdetail ) { - return ! execute_command( tune_cmd + " -U random " + partition .get_path(), operationdetail ) ; + return ! execute_command( tune_cmd + " -U random " + partition .get_path(), + operationdetail, EXEC_CHECK_STATUS ); } bool ext2::create( const Partition & new_partition, OperationDetail & operationdetail ) { return ! execute_command( mkfs_cmd + " -F -L \"" + new_partition.get_filesystem_label() + "\" " + new_partition.get_path(), - operationdetail, EXEC_CANCEL_SAFE ); + operationdetail, EXEC_CHECK_STATUS|EXEC_CANCEL_SAFE ); } bool ext2::resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition ) @@ -231,7 +233,7 @@ bool ext2::resize( const Partition & partition_new, OperationDetail & operationd str_temp += " " + Utils::num_to_str( floor( Utils::sector_to_unit( partition_new .get_sector_length(), partition_new .sector_size, UNIT_KIB ) ) ) + "K"; - return ! execute_command( str_temp, operationdetail ) ; + return ! execute_command( str_temp, operationdetail, EXEC_CHECK_STATUS ); } bool ext2::check_repair( const Partition & partition, OperationDetail & operationdetail ) @@ -241,7 +243,9 @@ bool ext2::check_repair( const Partition & partition, OperationDetail & operatio //exitstatus 256 isn't documented, but it's returned when the 'FILE SYSTEM IS MODIFIED' //this is quite normal (especially after a copy) so we let the function return true... - return ( exit_status == 0 || exit_status == 1 || exit_status == 2 || exit_status == 256 ) ; + bool success = ( exit_status == 0 || exit_status == 1 || exit_status == 2 || exit_status == 256 ); + set_status( operationdetail, success ); + return success; } bool ext2::move( const Partition & partition_new, diff --git a/src/f2fs.cc b/src/f2fs.cc index cf66bf37..84727e2b 100644 --- a/src/f2fs.cc +++ b/src/f2fs.cc @@ -44,7 +44,8 @@ FS f2fs::get_filesystem_support() bool f2fs::create( const Partition & new_partition, OperationDetail & operationdetail ) { return ! execute_command( "mkfs.f2fs -l \"" + new_partition.get_filesystem_label() + "\" " + - new_partition .get_path(), operationdetail ); + new_partition.get_path(), + operationdetail, EXEC_CHECK_STATUS ); } } //GParted diff --git a/src/fat16.cc b/src/fat16.cc index d0dd8868..033b3256 100644 --- a/src/fat16.cc +++ b/src/fat16.cc @@ -252,15 +252,16 @@ bool fat16::create( const Partition & new_partition, OperationDetail & operation pad_label( new_partition.get_filesystem_label() ) + "\" " + new_partition.get_path(), operationdetail, - EXEC_CANCEL_SAFE ); + EXEC_CHECK_STATUS|EXEC_CANCEL_SAFE ); } bool fat16::check_repair( const Partition & partition, OperationDetail & operationdetail ) { exit_status = execute_command( check_cmd + " -a -w -v " + partition .get_path(), operationdetail, EXEC_CANCEL_SAFE ); - - return ( exit_status == 0 || exit_status == 1 || exit_status == 256 ) ; + bool success = ( exit_status == 0 || exit_status == 1 || exit_status == 256 ); + set_status( operationdetail, success ); + return success; } //Private methods diff --git a/src/hfs.cc b/src/hfs.cc index 33dd12bb..e413a68a 100644 --- a/src/hfs.cc +++ b/src/hfs.cc @@ -82,13 +82,13 @@ bool hfs::create( const Partition & new_partition, OperationDetail & operationde cmd = "hformat " + new_partition .get_path() ; else cmd = "hformat -l \"" + new_partition.get_filesystem_label() + "\" " + new_partition.get_path(); - return ! execute_command( cmd , operationdetail ) ; + return ! execute_command( cmd , operationdetail, EXEC_CHECK_STATUS ); } bool hfs::check_repair( const Partition & partition, OperationDetail & operationdetail ) { //FIXME: find out what the returnvalue is in case of modified.. also check what the -a flag does.. (there is no manpage) - return ! execute_command( "hfsck -v " + partition .get_path(), operationdetail ) ; + return ! execute_command( "hfsck -v " + partition.get_path(), operationdetail, EXEC_CHECK_STATUS ); } } //GParted diff --git a/src/hfsplus.cc b/src/hfsplus.cc index 545c90e9..6d040531 100644 --- a/src/hfsplus.cc +++ b/src/hfsplus.cc @@ -80,12 +80,12 @@ bool hfsplus::create( const Partition & new_partition, OperationDetail & operati cmd = "mkfs.hfsplus " + new_partition .get_path() ; else cmd = "mkfs.hfsplus -v \"" + new_partition.get_filesystem_label() + "\" " + new_partition.get_path(); - return ! execute_command( cmd , operationdetail ) ; + return ! execute_command( cmd , operationdetail, EXEC_CHECK_STATUS ); } bool hfsplus::check_repair( const Partition & partition, OperationDetail & operationdetail ) { - return ! execute_command( "fsck.hfsplus -f -y " + partition .get_path(), operationdetail ) ; + return ! execute_command( "fsck.hfsplus -f -y " + partition.get_path(), operationdetail, EXEC_CHECK_STATUS ); } } //GParted diff --git a/src/jfs.cc b/src/jfs.cc index b400a6c9..c604d09d 100644 --- a/src/jfs.cc +++ b/src/jfs.cc @@ -132,7 +132,7 @@ void jfs::read_label( Partition & partition ) bool jfs::write_label( const Partition & partition, OperationDetail & operationdetail ) { return ! execute_command( "jfs_tune -L \"" + partition.get_filesystem_label() + "\" " + partition.get_path(), - operationdetail ); + operationdetail, EXEC_CHECK_STATUS ); } void jfs::read_uuid( Partition & partition ) @@ -153,14 +153,14 @@ void jfs::read_uuid( Partition & partition ) bool jfs::write_uuid( const Partition & partition, OperationDetail & operationdetail ) { - return ! execute_command( "jfs_tune -U random " + partition .get_path(), operationdetail ) ; + return ! execute_command( "jfs_tune -U random " + partition .get_path(), operationdetail, EXEC_CHECK_STATUS ); } bool jfs::create( const Partition & new_partition, OperationDetail & operationdetail ) { return ! execute_command( "mkfs.jfs -q -L \"" + new_partition.get_filesystem_label() + "\" " + - new_partition.get_path(), operationdetail, - EXEC_CANCEL_SAFE ); + new_partition.get_path(), + operationdetail, EXEC_CHECK_STATUS|EXEC_CANCEL_SAFE ); } bool jfs::resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition ) @@ -198,8 +198,9 @@ bool jfs::check_repair( const Partition & partition, OperationDetail & operation { exit_status = execute_command( "jfs_fsck -f " + partition.get_path(), operationdetail, EXEC_CANCEL_SAFE ); - - return ( exit_status == 0 || exit_status == 1 ) ; + bool success = ( exit_status == 0 || exit_status == 1 ); + set_status( operationdetail, success ); + return success; } } //GParted diff --git a/src/linux_swap.cc b/src/linux_swap.cc index 902def1b..1388f22b 100644 --- a/src/linux_swap.cc +++ b/src/linux_swap.cc @@ -133,7 +133,7 @@ void linux_swap::read_label( Partition & partition ) bool linux_swap::write_label( const Partition & partition, OperationDetail & operationdetail ) { return ! execute_command( "swaplabel -L \"" + partition.get_filesystem_label() + "\" " + partition.get_path(), - operationdetail ); + operationdetail, EXEC_CHECK_STATUS ); } void linux_swap::read_uuid( Partition & partition ) @@ -155,14 +155,15 @@ void linux_swap::read_uuid( Partition & partition ) bool linux_swap::write_uuid( const Partition & partition, OperationDetail & operationdetail ) { - return ! execute_command( "swaplabel -U \"" + Utils::generate_uuid() + "\" " + partition .get_path(), operationdetail ) ; + return ! execute_command( "swaplabel -U \"" + Utils::generate_uuid() + "\" " + partition .get_path(), + operationdetail, EXEC_CHECK_STATUS ); } bool linux_swap::create( const Partition & new_partition, OperationDetail & operationdetail ) { return ! execute_command( "mkswap -L \"" + new_partition.get_filesystem_label() + "\" " + new_partition.get_path(), - operationdetail ); + operationdetail, EXEC_CHECK_STATUS ); } bool linux_swap::resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition ) @@ -176,7 +177,7 @@ bool linux_swap::resize( const Partition & partition_new, OperationDetail & oper if ( ! partition_new .uuid .empty() ) command += " -U \"" + partition_new .uuid + "\" " ; command += partition_new .get_path() ; - bool exit_status = ! execute_command( command , operationdetail .get_last_child() ) ; + bool exit_status = ! execute_command( command , operationdetail.get_last_child(), EXEC_CHECK_STATUS ); operationdetail .get_last_child() .set_status( exit_status ? STATUS_SUCCES : STATUS_ERROR ) ; return exit_status ; diff --git a/src/lvm2_pv.cc b/src/lvm2_pv.cc index 21b412ac..4d859239 100644 --- a/src/lvm2_pv.cc +++ b/src/lvm2_pv.cc @@ -98,7 +98,7 @@ void lvm2_pv::set_used_sectors( Partition & partition ) bool lvm2_pv::create( const Partition & new_partition, OperationDetail & operationdetail ) { - return ! execute_command( "lvm pvcreate -M 2 " + new_partition .get_path(), operationdetail ) ; + return ! execute_command( "lvm pvcreate -M 2 " + new_partition.get_path(), operationdetail, EXEC_CHECK_STATUS ); } bool lvm2_pv::resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition ) @@ -108,12 +108,13 @@ bool lvm2_pv::resize( const Partition & partition_new, OperationDetail & operati size = " --setphysicalvolumesize " + Utils::num_to_str( floor( Utils::sector_to_unit( partition_new .get_sector_length(), partition_new .sector_size, UNIT_KIB ) ) ) + "K " ; - return ! execute_command( "lvm pvresize -v " + size + partition_new .get_path(), operationdetail ) ; + return ! execute_command( "lvm pvresize -v " + size + partition_new.get_path(), + operationdetail, EXEC_CHECK_STATUS ); } bool lvm2_pv::check_repair( const Partition & partition, OperationDetail & operationdetail ) { - return ! execute_command( "lvm pvck -v " + partition .get_path(), operationdetail ) ; + return ! execute_command( "lvm pvck -v " + partition.get_path(), operationdetail, EXEC_CHECK_STATUS ); } bool lvm2_pv::remove( const Partition & partition, OperationDetail & operationdetail ) @@ -125,7 +126,7 @@ bool lvm2_pv::remove( const Partition & partition, OperationDetail & operationde else //Must force the removal of a PV which is a member of a VG cmd = "lvm pvremove --force --force --yes " + partition .get_path() ; - return ! execute_command( cmd, operationdetail ) ; + return ! execute_command( cmd, operationdetail, EXEC_CHECK_STATUS ); } } //GParted diff --git a/src/nilfs2.cc b/src/nilfs2.cc index 7aa6a034..fb837466 100644 --- a/src/nilfs2.cc +++ b/src/nilfs2.cc @@ -137,7 +137,7 @@ bool nilfs2::write_label( const Partition & partition, OperationDetail & operati { return ! execute_command( "nilfs-tune -L \"" + partition.get_filesystem_label() + "\" " + partition.get_path(), - operationdetail ); + operationdetail, EXEC_CHECK_STATUS ); } void nilfs2::read_uuid( Partition & partition ) @@ -158,14 +158,15 @@ void nilfs2::read_uuid( Partition & partition ) bool nilfs2::write_uuid( const Partition & partition, OperationDetail & operationdetail ) { - return ! execute_command( "nilfs-tune -U " + Utils::generate_uuid() + " " + partition .get_path(), operationdetail ) ; + return ! execute_command( "nilfs-tune -U " + Utils::generate_uuid() + " " + partition .get_path(), + operationdetail, EXEC_CHECK_STATUS ); } bool nilfs2::create( const Partition & new_partition, OperationDetail & operationdetail ) { return ! execute_command( "mkfs.nilfs2 -L \"" + new_partition.get_filesystem_label() + "\" " + new_partition.get_path(), - operationdetail ); + operationdetail, EXEC_CHECK_STATUS ); } bool nilfs2::resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition ) diff --git a/src/ntfs.cc b/src/ntfs.cc index f757d9bf..67680ead 100644 --- a/src/ntfs.cc +++ b/src/ntfs.cc @@ -175,7 +175,7 @@ bool ntfs::write_label( const Partition & partition, OperationDetail & operation { return ! execute_command( "ntfslabel --force " + partition.get_path() + " \"" + partition.get_filesystem_label() + "\"", - operationdetail ); + operationdetail, EXEC_CHECK_STATUS ); } void ntfs::read_uuid( Partition & partition ) @@ -185,9 +185,11 @@ void ntfs::read_uuid( Partition & partition ) bool ntfs::write_uuid( const Partition & partition, OperationDetail & operationdetail ) { if ( partition .uuid == UUID_RANDOM_NTFS_HALF ) - return ! execute_command( "ntfslabel --new-half-serial " + partition .get_path(), operationdetail ) ; + return ! execute_command( "ntfslabel --new-half-serial " + partition.get_path(), + operationdetail, EXEC_CHECK_STATUS ); else - return ! execute_command( "ntfslabel --new-serial " + partition .get_path(), operationdetail ) ; + return ! execute_command( "ntfslabel --new-serial " + partition.get_path(), + operationdetail, EXEC_CHECK_STATUS ); return true ; } @@ -196,7 +198,7 @@ bool ntfs::create( const Partition & new_partition, OperationDetail & operationd { return ! execute_command( "mkntfs -Q -v -F -L \"" + new_partition.get_filesystem_label() + "\" " + new_partition.get_path(), - operationdetail, EXEC_CANCEL_SAFE ); + operationdetail, EXEC_CHECK_STATUS|EXEC_CANCEL_SAFE ); } bool ntfs::resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition ) @@ -213,14 +215,16 @@ bool ntfs::resize( const Partition & partition_new, OperationDetail & operationd //simulation.. operationdetail .add_child( OperationDetail( _("run simulation") ) ) ; - if ( ! execute_command( cmd + " --no-action " + partition_new .get_path(), operationdetail .get_last_child() ) ) + if ( ! execute_command( cmd + " --no-action " + partition_new.get_path(), + operationdetail.get_last_child(), EXEC_CHECK_STATUS ) ) { operationdetail .get_last_child() .set_status( STATUS_SUCCES ) ; //real resize operationdetail .add_child( OperationDetail( _("real resize") ) ) ; - if ( ! execute_command( cmd + " " + partition_new .get_path(), operationdetail .get_last_child() ) ) + if ( ! execute_command( cmd + " " + partition_new.get_path(), + operationdetail.get_last_child(), EXEC_CHECK_STATUS ) ) { operationdetail .get_last_child() .set_status( STATUS_SUCCES ) ; return_value = true ; @@ -244,12 +248,12 @@ bool ntfs::copy( const Partition & src_part, { return ! execute_command( "ntfsclone -f --overwrite " + dest_part.get_path() + " " + src_part.get_path(), operationdetail, - EXEC_CANCEL_SAFE ); + EXEC_CHECK_STATUS|EXEC_CANCEL_SAFE ); } bool ntfs::check_repair( const Partition & partition, OperationDetail & operationdetail ) { - return ! execute_command( "ntfsresize -i -f -v " + partition .get_path(), operationdetail ) ; + return ! execute_command( "ntfsresize -i -f -v " + partition.get_path(), operationdetail, EXEC_CHECK_STATUS ); } } //GParted diff --git a/src/reiser4.cc b/src/reiser4.cc index 392aba5f..c58e9d5e 100644 --- a/src/reiser4.cc +++ b/src/reiser4.cc @@ -139,14 +139,14 @@ void reiser4::read_uuid( Partition & partition ) bool reiser4::create( const Partition & new_partition, OperationDetail & operationdetail ) { return ! execute_command( "mkfs.reiser4 --force --yes --label \"" + new_partition.get_filesystem_label() + "\" " + - new_partition.get_path(), operationdetail, - EXEC_CANCEL_SAFE ); + new_partition.get_path(), + operationdetail, EXEC_CHECK_STATUS|EXEC_CANCEL_SAFE ); } bool reiser4::check_repair( const Partition & partition, OperationDetail & operationdetail ) { return ! execute_command( "fsck.reiser4 --yes --fix --quiet " + partition.get_path(), - operationdetail, EXEC_CANCEL_SAFE ); + operationdetail, EXEC_CHECK_STATUS|EXEC_CANCEL_SAFE ); } } //GParted diff --git a/src/reiserfs.cc b/src/reiserfs.cc index 89d6babe..536498d8 100644 --- a/src/reiserfs.cc +++ b/src/reiserfs.cc @@ -133,7 +133,7 @@ bool reiserfs::write_label( const Partition & partition, OperationDetail & opera { return ! execute_command( "reiserfstune --label \"" + partition.get_filesystem_label() + "\" " + partition.get_path(), - operationdetail ); + operationdetail, EXEC_CHECK_STATUS ); } void reiserfs::read_uuid( Partition & partition ) @@ -154,14 +154,15 @@ void reiserfs::read_uuid( Partition & partition ) bool reiserfs::write_uuid( const Partition & partition, OperationDetail & operationdetail ) { - return ! execute_command( "reiserfstune -u random " + partition .get_path(), operationdetail ) ; + return ! execute_command( "reiserfstune -u random " + partition.get_path(), + operationdetail, EXEC_CHECK_STATUS ); } bool reiserfs::create( const Partition & new_partition, OperationDetail & operationdetail ) { return ! execute_command( "mkreiserfs -f -f --label \"" + new_partition.get_filesystem_label() + "\" " + new_partition.get_path(), - operationdetail, EXEC_CANCEL_SAFE ); + operationdetail, EXEC_CHECK_STATUS|EXEC_CANCEL_SAFE ); } bool reiserfs::resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition ) @@ -175,16 +176,18 @@ bool reiserfs::resize( const Partition & partition_new, OperationDetail & operat Glib::ustring cmd = "sh -c 'echo y | resize_reiserfs" + size + " " + partition_new .get_path() + "'" ; exit_status = execute_command( cmd, operationdetail ) ; - - return ( exit_status == 0 || exit_status == 256 ) ; + bool success = ( exit_status == 0 || exit_status == 256 ); + set_status( operationdetail, success ); + return success; } bool reiserfs::check_repair( const Partition & partition, OperationDetail & operationdetail ) { exit_status = execute_command( "reiserfsck --yes --fix-fixable --quiet " + partition.get_path(), operationdetail, EXEC_CANCEL_SAFE ); - - return ( exit_status == 0 || exit_status == 1 || exit_status == 256 ) ; + bool success = ( exit_status == 0 || exit_status == 1 || exit_status == 256 ); + set_status( operationdetail, success ); + return success; } } //GParted diff --git a/src/xfs.cc b/src/xfs.cc index 205af203..aa6649f0 100644 --- a/src/xfs.cc +++ b/src/xfs.cc @@ -146,7 +146,7 @@ bool xfs::write_label( const Partition & partition, OperationDetail & operationd cmd = "xfs_admin -L -- " + partition .get_path() ; else cmd = "xfs_admin -L \"" + partition.get_filesystem_label() + "\" " + partition.get_path(); - return ! execute_command( cmd, operationdetail ) ; + return ! execute_command( cmd, operationdetail, EXEC_CHECK_STATUS ); } void xfs::read_uuid( Partition & partition ) @@ -167,7 +167,7 @@ void xfs::read_uuid( Partition & partition ) bool xfs::write_uuid( const Partition & partition, OperationDetail & operationdetail ) { - return ! execute_command( "xfs_admin -U generate " + partition .get_path(), operationdetail ) ; + return ! execute_command( "xfs_admin -U generate " + partition.get_path(), operationdetail, EXEC_CHECK_STATUS ); } bool xfs::create( const Partition & new_partition, OperationDetail & operationdetail ) @@ -175,7 +175,7 @@ bool xfs::create( const Partition & new_partition, OperationDetail & operationde return ! execute_command( "mkfs.xfs -f -L \"" + new_partition.get_filesystem_label() + "\" " + new_partition.get_path(), operationdetail, - EXEC_CANCEL_SAFE ); + EXEC_CHECK_STATUS|EXEC_CANCEL_SAFE ); } bool xfs::resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition ) @@ -261,7 +261,7 @@ bool xfs::copy( const Partition & src_part, bool xfs::check_repair( const Partition & partition, OperationDetail & operationdetail ) { return ! execute_command( "xfs_repair -v " + partition .get_path(), operationdetail, - EXEC_CANCEL_SAFE ); + EXEC_CHECK_STATUS|EXEC_CANCEL_SAFE ); } } //GParted