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:
parent
8e9d7ace7b
commit
c65d379769
@ -1,5 +1,6 @@
|
||||
Version 2.03.27 -
|
||||
==================
|
||||
Do not accept duplicate device names for pvcreate.
|
||||
|
||||
Version 2.03.26 - 23rd August 2024
|
||||
==================================
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user