diff --git a/include/SWRaid_Info.h b/include/SWRaid_Info.h index 1c37a546..baadf35e 100644 --- a/include/SWRaid_Info.h +++ b/include/SWRaid_Info.h @@ -61,7 +61,7 @@ public: static FSType get_fstype(const Glib::ustring& member_path); static const Glib::ustring& get_array(const Glib::ustring& member_path); static const Glib::ustring& get_uuid(const Glib::ustring& member_path); - static Glib::ustring get_label( const Glib::ustring & member_path ); + static const Glib::ustring& get_label(const Glib::ustring& member_path); private: static void initialise_if_required(); diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc index ece68950..b85c0f0a 100644 --- a/src/GParted_Core.cc +++ b/src/GParted_Core.cc @@ -1048,7 +1048,7 @@ void GParted_Core::set_partition_label_and_uuid( Partition & partition ) if (partition.fstype == FS_LINUX_SWRAID || partition.fstype == FS_ATARAID ) { - Glib::ustring label = SWRaid_Info::get_label( partition_path ); + const Glib::ustring& label = SWRaid_Info::get_label(partition_path); if ( ! label.empty() ) partition.set_filesystem_label( label ); diff --git a/src/SWRaid_Info.cc b/src/SWRaid_Info.cc index 6e1e12c4..ac254354 100644 --- a/src/SWRaid_Info.cc +++ b/src/SWRaid_Info.cc @@ -103,11 +103,12 @@ const Glib::ustring& SWRaid_Info::get_uuid(const Glib::ustring& member_path) return memb.uuid; } + // Return array label (array name in mdadm terminology) for the specified member, or "" // when the array has no label or there is no such member. // (Metadata 0.90 arrays don't have names. Metata 1.x arrays are always named, getting a // default of hostname ":" array number when not otherwise specified). -Glib::ustring SWRaid_Info::get_label( const Glib::ustring & member_path ) +const Glib::ustring& SWRaid_Info::get_label(const Glib::ustring& member_path) { initialise_if_required(); const SWRaid_Member & memb = get_cache_entry_by_member( member_path );