Pablo Greco 40546a
From f4d9b6252bd2b2b5a3c70a3869ce49a3a9e1a9cc Mon Sep 17 00:00:00 2001
Pablo Greco 40546a
Message-Id: <f4d9b6252bd2b2b5a3c70a3869ce49a3a9e1a9cc@dist-git>
Pablo Greco 40546a
From: Michal Privoznik <mprivozn@redhat.com>
Pablo Greco 40546a
Date: Fri, 6 Mar 2020 15:51:47 +0100
Pablo Greco 40546a
Subject: [PATCH] RHEL: virutil: Accept non-block devices in virGetDeviceID()
Pablo Greco 40546a
Pablo Greco 40546a
If a caller wants to learn major or minor number for a device,
Pablo Greco 40546a
let them. There's no need to check if the device is a block
Pablo Greco 40546a
device here.
Pablo Greco 40546a
Pablo Greco 40546a
https://bugzilla.redhat.com/show_bug.cgi?id=1808388
Pablo Greco 40546a
Pablo Greco 40546a
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Pablo Greco 40546a
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Pablo Greco 40546a
Message-Id: <20200306145149.1610286-5-abologna@redhat.com>
Pablo Greco 40546a
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Pablo Greco 40546a
---
Pablo Greco 40546a
 src/util/virutil.c | 3 ---
Pablo Greco 40546a
 1 file changed, 3 deletions(-)
Pablo Greco 40546a
Pablo Greco 40546a
diff --git a/src/util/virutil.c b/src/util/virutil.c
Pablo Greco 40546a
index cd67f54bc2..2448eba073 100644
Pablo Greco 40546a
--- a/src/util/virutil.c
Pablo Greco 40546a
+++ b/src/util/virutil.c
Pablo Greco 40546a
@@ -1693,9 +1693,6 @@ virGetDeviceID(const char *path, int *maj, int *min)
Pablo Greco 40546a
     if (stat(path, &sb) < 0)
Pablo Greco 40546a
         return -errno;
Pablo Greco 40546a
 
Pablo Greco 40546a
-    if (!S_ISBLK(sb.st_mode))
Pablo Greco 40546a
-        return -EINVAL;
Pablo Greco 40546a
-
Pablo Greco 40546a
     if (maj)
Pablo Greco 40546a
         *maj = major(sb.st_rdev);
Pablo Greco 40546a
     if (min)
Pablo Greco 40546a
-- 
Pablo Greco 40546a
2.25.1
Pablo Greco 40546a