Refactor reiserfs::set_used_sectors() into if fail return early pattern (!119)

Closes !119 -  Tidy-ups for file system interface classes
This commit is contained in:
Mike Fleetwood 2023-10-10 10:12:49 +01:00 committed by Curtis Gedak
parent 1f72c5f0e5
commit a603828275
1 changed files with 32 additions and 31 deletions

View File

@ -81,11 +81,20 @@ FS reiserfs::get_filesystem_support()
return fs ;
}
void reiserfs::set_used_sectors(Partition& partition)
{
if ( ! Utils::execute_command( "debugreiserfs " + Glib::shell_quote( partition.get_path() ),
output, error, true ) )
exit_status = Utils::execute_command("debugreiserfs " + Glib::shell_quote(partition.get_path()),
output, error, true);
if (exit_status != 0)
{
if (! output.empty())
partition.push_back_message(output);
if (! error.empty())
partition.push_back_message(error);
return;
}
long long block_count = -1;
Glib::ustring::size_type index = output.find("\nCount of blocks on the device:");
if (index < output.length())
@ -109,15 +118,7 @@ void reiserfs::set_used_sectors( Partition & partition )
partition.fs_block_size = block_size;
}
}
else
{
if ( ! output .empty() )
partition.push_back_message( output );
if ( ! error .empty() )
partition.push_back_message( error );
}
}
void reiserfs::read_label( Partition & partition )
{