[gparted] Refactor fat16::read_uuid() into if fail return early pattern (!104)
- From: Curtis Gedak <gedakc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gparted] Refactor fat16::read_uuid() into if fail return early pattern (!104)
- Date: Mon, 4 Jul 2022 18:09:40 +0000 (UTC)
commit ff177038e55675b9423361d4ee1a89e16684e5e4
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date: Sat Jun 18 09:36:49 2022 +0100
Refactor fat16::read_uuid() into if fail return early pattern (!104)
Closes !104 - Add Alpine Linux CI jobs and resolve label and UUID issues
with FAT16/32
src/fat16.cc | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
---
diff --git a/src/fat16.cc b/src/fat16.cc
index 5f1ae66d..9b0d08f4 100644
--- a/src/fat16.cc
+++ b/src/fat16.cc
@@ -219,26 +219,26 @@ bool fat16::write_label( const Partition & partition, OperationDetail & operatio
return ! execute_command( cmd, operationdetail, EXEC_CHECK_STATUS );
}
-void fat16::read_uuid( Partition & partition )
-{
- Glib::ustring cmd = "mdir -f :: -i " + Glib::shell_quote( partition.get_path() );
- if ( ! Utils::execute_command( cmd, output, error, true ) )
+void fat16::read_uuid(Partition& partition)
+{
+ exit_status = Utils::execute_command("mdir -f :: -i " + Glib::shell_quote(partition.get_path()),
+ output, error, true);
+ if (exit_status != 0)
{
- partition .uuid = Utils::regexp_label( output, "Volume Serial Number
is[[:blank:]]([^[:space:]]+)" ) ;
- if ( partition .uuid == "0000-0000" )
- partition .uuid .clear() ;
+ 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, "Volume Serial Number is[[:blank:]]([^[:space:]]+)");
+ if (partition.uuid == "0000-0000")
+ partition.uuid.clear();
}
+
bool fat16::write_uuid( const Partition & partition, OperationDetail & operationdetail )
{
Glib::ustring cmd = "mlabel -s -n :: -i " + Glib::shell_quote( partition.get_path() );
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]