summaryrefslogtreecommitdiffstats
path: root/libfdisk/src/partition.c
diff options
context:
space:
mode:
Diffstat (limited to 'libfdisk/src/partition.c')
-rw-r--r--libfdisk/src/partition.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libfdisk/src/partition.c b/libfdisk/src/partition.c
index 05474a041..80a43ffde 100644
--- a/libfdisk/src/partition.c
+++ b/libfdisk/src/partition.c
@@ -85,7 +85,13 @@ static struct fdisk_partition *__copy_partition(struct fdisk_partition *o)
if (!n)
return NULL;
+
memcpy(n, o, sizeof(*n));
+
+ /* do not copy reference to lists, etc.*/
+ n->refcount = 1;
+ INIT_LIST_HEAD(&n->parts);
+
if (n->type)
fdisk_ref_parttype(n->type);
if (o->name)
@@ -100,6 +106,10 @@ static struct fdisk_partition *__copy_partition(struct fdisk_partition *o)
n->fsuuid = strdup(o->fsuuid);
if (o->fslabel)
n->fslabel = strdup(o->fslabel);
+ if (o->start_chs)
+ n->start_chs = strdup(o->start_chs);
+ if (o->end_chs)
+ n->end_chs = strdup(o->end_chs);
return n;
}