From b4067e84c7884f2b46effdf31418f66cc0b902bb Mon Sep 17 00:00:00 2001 From: David Teigland Date: Fri, 5 Nov 2021 16:21:23 -0500 Subject: [PATCH] fix device name from devno for partitions sysfs files for partitions are different from whole devices and will require more work to translate to device names. --- lib/device/dev-cache.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c index ce82a9303..e71cef38d 100644 --- a/lib/device/dev-cache.c +++ b/lib/device/dev-cache.c @@ -2125,7 +2125,7 @@ static char *_get_devname_from_devno(struct cmd_context *cmd, dev_t devno) } if (!(dir = opendir(path))) - return NULL; + goto try_partition; while ((dirent = readdir(dir))) { if (dirent->d_name[0] == '.') @@ -2175,6 +2175,7 @@ static char *_get_devname_from_devno(struct cmd_context *cmd, dev_t devno) * major minor #blocks name */ +try_partition: if (!(fp = fopen("/proc/partitions", "r"))) return NULL; -- 2.43.5