mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
vgrename: check if new and old names match
When the first arg is a UUID and vgrename translates that UUID to a current VG name, the old and new VG names are not being checked for equality. If they are equal, it produces an internal error rather than a proper error.
This commit is contained in:
parent
cd937efa77
commit
7ec61cd5b9
@ -110,7 +110,13 @@ static int vg_rename_path(struct cmd_context *cmd, const char *old_vg_path,
|
|||||||
log_suppress(2);
|
log_suppress(2);
|
||||||
found_id = id_read_format(&id, vg_name_old);
|
found_id = id_read_format(&id, vg_name_old);
|
||||||
log_suppress(0);
|
log_suppress(0);
|
||||||
|
|
||||||
if (found_id && (vg_name = lvmcache_vgname_from_vgid(cmd->mem, (char *)id.uuid))) {
|
if (found_id && (vg_name = lvmcache_vgname_from_vgid(cmd->mem, (char *)id.uuid))) {
|
||||||
|
if (!strcmp(vg_name, vg_name_new)) {
|
||||||
|
log_error("New VG name must differ from the old VG name.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
vg_name_old = vg_name;
|
vg_name_old = vg_name;
|
||||||
vgid = (char *)id.uuid;
|
vgid = (char *)id.uuid;
|
||||||
} else
|
} else
|
||||||
|
Loading…
Reference in New Issue
Block a user