1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-18 10:04:20 +03:00

lvchange, vgchange: fix the system_id check

The check for matching system_id needs to check
that the system_id is not blank.
This commit is contained in:
David Teigland 2015-03-03 16:45:16 -06:00
parent cccc2b2980
commit 2477495922
2 changed files with 4 additions and 2 deletions

View File

@ -191,7 +191,8 @@ static int _lvchange_activate(struct cmd_context *cmd, struct logical_volume *lv
* a foreign VG, which allows the VG to be accessed by lvchange -a * a foreign VG, which allows the VG to be accessed by lvchange -a
* so the LV can be deactivated. * so the LV can be deactivated.
*/ */
if (lv->vg->system_id && cmd->system_id && if (lv->vg->system_id && lv->vg->system_id[0] &&
cmd->system_id && cmd->system_id[0] &&
strcmp(lv->vg->system_id, cmd->system_id) && strcmp(lv->vg->system_id, cmd->system_id) &&
is_change_activating(activate)) { is_change_activating(activate)) {
log_error("Cannot activate LVs in a foreign VG."); log_error("Cannot activate LVs in a foreign VG.");

View File

@ -201,7 +201,8 @@ int vgchange_activate(struct cmd_context *cmd, struct volume_group *vg,
* a foreign VG, which allows the VG to be accessed by vgchange -a * a foreign VG, which allows the VG to be accessed by vgchange -a
* so the LV can be deactivated. * so the LV can be deactivated.
*/ */
if (vg->system_id && cmd->system_id && if (vg->system_id && vg->system_id[0] &&
cmd->system_id && cmd->system_id[0] &&
strcmp(vg->system_id, cmd->system_id) && strcmp(vg->system_id, cmd->system_id) &&
is_change_activating(activate)) { is_change_activating(activate)) {
log_error("Cannot activate LVs in a foreign VG."); log_error("Cannot activate LVs in a foreign VG.");