[gparted] Set partition type when formatting to cleared (!36)
- From: Curtis Gedak <gedakc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gparted] Set partition type when formatting to cleared (!36)
- Date: Mon, 15 Apr 2019 18:51:45 +0000 (UTC)
commit 4d9dc14b0ea6d5b4365a3a30e55d736a042bacde
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date: Sat Apr 13 14:06:32 2019 +0100
Set partition type when formatting to cleared (!36)
Formatting a partition to cleared over the top of LVM2 PV leaves the
"lvm" flag set on the partition; where as formatting with an actual file
system over the top of an LVM2 PV clears the "lvm" flag. This is true
for both MSDOS and GPT partitioned drives.
Fix by setting the partition type when formatting to cleared too.
Closes !36 - Set partition type when clearing partition contents
src/GParted_Core.cc | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index 31f41049..6a31e977 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -2105,7 +2105,8 @@ bool GParted_Core::format( const Partition & partition, OperationDetail & operat
}
if ( partition .filesystem == FS_CLEARED )
- return erase_filesystem_signatures( partition, operationdetail ) ;
+ return erase_filesystem_signatures(partition, operationdetail)
+ && set_partition_type(partition, operationdetail);
else
return erase_filesystem_signatures( partition, operationdetail )
&& set_partition_type( partition, operationdetail )
@@ -3549,8 +3550,12 @@ bool GParted_Core::set_partition_type( const Partition & partition, OperationDet
{
Glib::ustring fs_type = Utils::get_filesystem_string( partition.filesystem );
- // Lookup libparted file system type using GParted's name, as most match
- PedFileSystemType * lp_fs_type = ped_file_system_type_get( fs_type.c_str() );
+ // Lookup libparted file system type using GParted's name, as most
+ // match. Exclude cleared as the name won't be recognised by
+ // libparted and get_filesystem_string() has also translated it.
+ PedFileSystemType *lp_fs_type = NULL;
+ if (partition.filesystem != FS_CLEARED)
+ lp_fs_type = ped_file_system_type_get(fs_type.c_str());
// If not found, and FS is linux-swap, then try linux-swap(v1)
if ( ! lp_fs_type && fs_type == "linux-swap" )
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]