Skip to contentSkip to conversation

LVM2 liblvm/lvm_lv.c liblvm/lvm_pv.c tools/vgr ...

PATCH [email protected] 1 participant 1 message Feb 8, 2012

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac at sourceware.org 2012-02-08 11:41:18

Modified files:
liblvm : lvm_lv.c lvm_pv.c
tools : vgreduce.c

Log message:
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.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/liblvm/lvm_lv.c.diff?cvsroot=lvm2&r1=1.36&r2=1.37
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/liblvm/lvm_pv.c.diff?cvsroot=lvm2&r1=1.20&r2=1.21
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgreduce.c.diff?cvsroot=lvm2&r1=1.113&r2=1.114

liblvm/lvm_lv.c +5 -5
@@ -270,12 +270,12 @@
 		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]))
liblvm/lvm_pv.c +5 -5
@@ -107,12 +107,12 @@
 		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;
tools/vgreduce.c +1 -1
@@ -213,7 +213,7 @@
 		return EINVALID_CMD_LINE;
 	}
 	
-	if (!argc && repairing) {
+	if (!argc) { /* repairing */
 		log_error("Please give volume group name");
 		return EINVALID_CMD_LINE;
 	}