Refactor reiser4::read_uuid() into if fail return early pattern
This commit is contained in:
parent
975d9ecdc9
commit
2a76af5beb
|
@ -127,23 +127,24 @@ void reiser4::read_label( Partition & partition )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void reiser4::read_uuid( Partition & partition )
|
||||
{
|
||||
if ( ! Utils::execute_command( "debugfs.reiser4 " + Glib::shell_quote( partition.get_path() ),
|
||||
output, error, true ) )
|
||||
exit_status = Utils::execute_command("debugfs.reiser4 " + Glib::shell_quote( partition.get_path()),
|
||||
output, error, true);
|
||||
if (exit_status != 0)
|
||||
{
|
||||
partition .uuid = Utils::regexp_label( output, "uuid:[[:blank:]]*(" RFC4122_NONE_NIL_UUID_REGEXP ")" ) ;
|
||||
if (! output.empty())
|
||||
partition.push_back_message(output);
|
||||
if (! error.empty())
|
||||
partition.push_back_message(error);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ! output .empty() )
|
||||
partition.push_back_message( output );
|
||||
|
||||
if ( ! error .empty() )
|
||||
partition.push_back_message( error );
|
||||
}
|
||||
partition.uuid = Utils::regexp_label(output, "uuid:[[:blank:]]*(" RFC4122_NONE_NIL_UUID_REGEXP ")");
|
||||
}
|
||||
|
||||
|
||||
bool reiser4::create( const Partition & new_partition, OperationDetail & operationdetail )
|
||||
{
|
||||
return ! execute_command( "mkfs.reiser4 --force --yes --label " +
|
||||
|
|
Loading…
Reference in New Issue