Skip to contentSkip to conversation

main - cleanup: always initialize historical ptr

PATCH Zdenek Kabelac 1 participant 1 message Oct 6, 2021

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=5ccb373d869ca23afc10416c2319331eb108e16b
Commit:        5ccb373d869ca23afc10416c2319331eb108e16b
Parent:        a841babaf7f0108797ef18af0777721742c8656c
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Fri Oct 1 13:53:28 2021 +0200
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Wed Oct 6 15:43:31 2021 +0200

cleanup: always initialize historical ptr

Set ptr for all paths.

---
 lib/metadata/metadata.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
lib/metadata/metadata.c +8 -6
index d5ef7f7cb..ad908634a 100644
@@ -1701,17 +1701,19 @@ struct generic_logical_volume *find_historical_glv(const struct volume_group *vg
 
 int lv_name_is_used_in_vg(const struct volume_group *vg, const char *name, int *historical)
 {
-	int found = 0;
+	int found;
 
-	if (find_lv(vg, name)) {
+	if (historical)
+		*historical = 0;
+
+	if (find_lv(vg, name))
 		found = 1;
-		if (historical)
-			*historical = 0;
-	} else if (find_historical_glv(vg, name, 0, NULL)) {
+	else if (find_historical_glv(vg, name, 0, NULL)) {
 		found = 1;
 		if (historical)
 			*historical = 1;
-	}
+	} else
+		found = 0;
 
 	return found;
 }