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

Remove duplicate test

Tested condition has been already evaluated before
For strlen() code has already excluded <ID_LEN.
For repairing, already tested (!argc && !repairing) before.
This commit is contained in:
Zdenek Kabelac 2012-02-08 11:41:18 +00:00
parent d75c5f06f0
commit eae8784ae2
3 changed files with 11 additions and 11 deletions

View File

@ -270,12 +270,12 @@ lv_t lvm_lv_from_uuid(vg_t vg, const char *uuid)
log_errno (EINVAL, "Invalid UUID string length");
return NULL;
}
if (strlen(uuid) >= ID_LEN) {
if (!id_read_format(&id, uuid)) {
log_errno(EINVAL, "Invalid UUID format");
return NULL;
}
if (!id_read_format(&id, uuid)) {
log_errno(EINVAL, "Invalid UUID format.");
return NULL;
}
dm_list_iterate_items(lvl, &vg->lvs) {
if (id_equal(&vg->id, &lvl->lv->lvid.id[0]) &&
id_equal(&id, &lvl->lv->lvid.id[1]))

View File

@ -107,12 +107,12 @@ pv_t lvm_pv_from_uuid(vg_t vg, const char *uuid)
log_errno (EINVAL, "Invalid UUID string length");
return NULL;
}
if (strlen(uuid) >= ID_LEN) {
if (!id_read_format(&id, uuid)) {
log_errno(EINVAL, "Invalid UUID format");
return NULL;
}
if (!id_read_format(&id, uuid)) {
log_errno(EINVAL, "Invalid UUID format.");
return NULL;
}
dm_list_iterate_items(pvl, &vg->pvs) {
if (id_equal(&id, &pvl->pv->id))
return pvl->pv;

View File

@ -213,7 +213,7 @@ int vgreduce(struct cmd_context *cmd, int argc, char **argv)
return EINVALID_CMD_LINE;
}
if (!argc && repairing) {
if (!argc) { /* repairing */
log_error("Please give volume group name");
return EINVALID_CMD_LINE;
}