libfdisk: improve partition copy on resize
It seems pretty fragile to copy also reference counting and reference to table list. Addresses: https://github.com/karelzak/util-linux/pull/822 Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
1768d77c18
commit
10c39f03a1
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue