Make format work with whole disk devices (#743181)

Formatting a whole disk device fails on the set partition type step with
libparted error "unrecognised disk label".  This is because the previous
step just cleared the old file system signatures leaving libparted with
nothing to recognise.  Therefore libparted doesn't present a virtual
"loop" partition table.

As there is no partition table, there's no partition and no partition
type.  Just skip setting the partition type on whole disk devices.

Bug 743181 - Add unpartitioned drive read-write support
This commit is contained in:
Mike Fleetwood 2015-01-10 20:34:45 +00:00 committed by Curtis Gedak
parent dc4e69136c
commit db8d964fba
1 changed files with 3 additions and 0 deletions

View File

@ -2059,6 +2059,9 @@ bool GParted_Core::format( const Partition & partition, OperationDetail & operat
{
if ( partition .filesystem == FS_CLEARED )
return erase_filesystem_signatures( partition, operationdetail ) ;
else if ( partition.whole_device )
return erase_filesystem_signatures( partition, operationdetail )
&& create_filesystem( partition, operationdetail );
else
return erase_filesystem_signatures( partition, operationdetail )
&& set_partition_type( partition, operationdetail )