From 0c653fc9a51e4f6cc4d48f56bc5d94f4f2b4d6f5 Mon Sep 17 00:00:00 2001 From: Jiri Denemark Date: Thu, 10 Oct 2024 15:14:36 +0200 Subject: [PATCH] util: Rename variable "major" in virIsDevMapperDevice major() is a macro defined in sys/sysmacros.h so luckily the code works, but it's very confusing. Let's rename the local variable to make the difference between it and the macro more obvious. And while touching the line we can also initialize it to make sure "clever" analyzers do not think it may be used uninitialized. Signed-off-by: Jiri Denemark Reviewed-by: Laine Stump --- src/util/virdevmapper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/util/virdevmapper.c b/src/util/virdevmapper.c index 70ce0f0c23..d0eae671ab 100644 --- a/src/util/virdevmapper.c +++ b/src/util/virdevmapper.c @@ -321,14 +321,14 @@ bool virIsDevMapperDevice(const char *dev_name) { struct stat buf; - unsigned int major; + unsigned int maj = 0; - if (virDevMapperGetMajor(&major) < 0) + if (virDevMapperGetMajor(&maj) < 0) return false; if (!stat(dev_name, &buf) && S_ISBLK(buf.st_mode) && - major(buf.st_rdev) == major) + major(buf.st_rdev) == maj) return true; return false; -- 2.39.5