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
This commit is contained in:
Mike Fleetwood 2019-04-13 14:06:32 +01:00 committed by Curtis Gedak
parent 5d2dc72144
commit 4d9dc14b0e

View file

@ -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" )