OSDN Git Service

libparted: copy the needs_clobber value in ped_disk_duplicate()
authorHans de Goede <hdegoede@redhat.com>
Thu, 18 Feb 2010 14:34:41 +0000 (15:34 +0100)
committerJim Meyering <meyering@redhat.com>
Mon, 22 Feb 2010 08:24:23 +0000 (09:24 +0100)
Most duplicate disk_ops use ped_disk_new_fresh, which sets needs_clobber
to 1. This would lead to clobbering the disk when committing a duplicate
disk even when the original disk was not made with ped_disk_new_fresh.
* libparted/disk.c (ped_disk_duplicate): Copy the needs_clobber member.
* NEWS (Bug fixes): Describe it.

NEWS
libparted/disk.c

diff --git a/NEWS b/NEWS
index 8e80746..30ca181 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -38,6 +38,11 @@ GNU parted NEWS                                    -*- outline -*-
   or a user might encounter a failure to format or delete a newly
   created partition, respectively.
 
+  libparted: committing a disk that was returned by ped_disk_duplicate
+  would always result in ped_disk_clobber being called (and thus the first
+  and last 9KiB of the disk being zeroed), even if the duplicated disk,
+  was not returned by ped_disk_fresh().
+
 
 * Noteworthy changes in release 2.1 (2009-12-20) [stable]
 
index b819d59..fc5ef17 100644 (file)
@@ -276,6 +276,9 @@ ped_disk_duplicate (const PedDisk* old_disk)
        }
        if (!_disk_pop_update_mode (new_disk))
                goto error_destroy_new_disk;
+
+        new_disk->needs_clobber = old_disk->needs_clobber;
+
        return new_disk;
 
 error_destroy_new_disk: