On 10/11/24 10:16 AM, Jiri Denemark wrote:
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 <jdenemar(a)redhat.com>
Reviewed-by: Laine Stump <laine(a)redhat.com>
---
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;