1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

toollib: do not accept duplicate device name on pvcreate input

This commit is contained in:
Peter Rajnoha 2024-08-28 10:35:18 +02:00
parent 8e9d7ace7b
commit c65d379769
No known key found for this signature in database
GPG Key ID: E776664036DF84AB
3 changed files with 10 additions and 0 deletions

View File

@ -1,5 +1,6 @@
Version 2.03.27 -
==================
Do not accept duplicate device names for pvcreate.
Version 2.03.26 - 23rd August 2024
==================================

View File

@ -25,6 +25,10 @@ else
mdatypes='2'
fi
# pvcreate fails when the same device appears twice on input
not pvcreate "$dev1" "$dev1" 2>err
grep "Duplicate device name found on input" err
for mdatype in $mdatypes
do
# pvcreate (lvm$mdatype) refuses to overwrite an mounted filesystem (bz168330)

View File

@ -5614,6 +5614,11 @@ int pvcreate_each_device(struct cmd_context *cmd,
pv_name = pp->pv_names[i];
if (_pvcreate_list_find_name(&pp->arg_devices, pv_name)) {
log_error("Duplicate device name found on input: %s.", pv_name);
return 0;
}
if (!(pd = dm_pool_zalloc(cmd->mem, sizeof(*pd)))) {
log_error("alloc failed.");
return 0;