[gparted] Make format work with whole disk devices (#743181)



commit db8d964fba799dd986a43714e5ad7bcf0b3b6cee
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Sat Jan 10 20:34:45 2015 +0000

    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

 src/GParted_Core.cc |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index 1418769..ff4e393 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -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 )


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]