Re: [PATCH] util: Rename variable "major" in virIsDevMapperDevice

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>

Reviewed-by: Laine Stump <laine@xxxxxxxxxx>

---
  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;



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux