summaryrefslogtreecommitdiff
path: root/libparted/disk.c
diff options
context:
space:
mode:
authorOtavio Salvador <otavio@ossystems.com.br>2007-08-30 09:52:03 -0300
committerOtavio Salvador <otavio@ossystems.com.br>2007-08-31 20:06:01 -0300
commit7baa9261b8648840b0d615ceaafcd473e9495dab (patch)
tree2ed5a6a2c3358561089c32efe79cfc97685a6535 /libparted/disk.c
parent81ccd3f6e5acee515f5778111376666d88349025 (diff)
downloadparted-7baa9261b8648840b0d615ceaafcd473e9495dab.tar.gz
Really duplicate the disk instead of readd every partition
To avoid possible differences between the original disk layout and the duplicated one, a raw copy is done. Has been identified a case[1] where extended partitions had their positions changed due this. 1. http://bugs.debian.org/294520 The recipe[2] to reproduce the problem, on the provided URI, has been used to produced a test and hence be sure it's not forgotten anymore. 2. http://bugs.debian.org/294520#34 The fix has been produced by Samuel Thibault <samuel.thibault@ens-lyon.org>
Diffstat (limited to 'libparted/disk.c')
-rw-r--r--libparted/disk.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/libparted/disk.c b/libparted/disk.c
index e2e55c3..34b1677 100644
--- a/libparted/disk.c
+++ b/libparted/disk.c
@@ -223,23 +223,24 @@ static int
_add_duplicate_part (PedDisk* disk, PedPartition* old_part)
{
PedPartition* new_part;
- PedConstraint* constraint_exact;
+ int ret;
new_part = disk->type->ops->partition_duplicate (old_part);
if (!new_part)
goto error;
new_part->disk = disk;
- constraint_exact = ped_constraint_exact (&new_part->geom);
- if (!constraint_exact)
+ _disk_push_update_mode (disk);
+ ret = _disk_raw_add (disk, new_part);
+ _disk_pop_update_mode (disk);
+ if (!ret)
goto error_destroy_new_part;
- if (!ped_disk_add_partition (disk, new_part, constraint_exact))
- goto error_destroy_constraint_exact;
- ped_constraint_destroy (constraint_exact);
+#ifdef DEBUG
+ if (!_disk_check_sanity (disk))
+ goto error_destroy_new_part;
+#endif
return 1;
-error_destroy_constraint_exact:
- ped_constraint_destroy (constraint_exact);
error_destroy_new_part:
ped_partition_destroy (new_part);
error: