[lvm-devel] main - cleanup: always initialize historical ptr

Zdenek Kabelac zkabelac at sourceware.org
Wed Oct 6 13:47:53 UTC 2021


Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=5ccb373d869ca23afc10416c2319331eb108e16b
Commit:        5ccb373d869ca23afc10416c2319331eb108e16b
Parent:        a841babaf7f0108797ef18af0777721742c8656c
Author:        Zdenek Kabelac <zkabelac at redhat.com>
AuthorDate:    Fri Oct 1 13:53:28 2021 +0200
Committer:     Zdenek Kabelac <zkabelac at redhat.com>
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(-)

diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index d5ef7f7cb..ad908634a 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -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;
 }




More information about the lvm-devel mailing list