summaryrefslogtreecommitdiffstats
path: root/misc-utils
diff options
context:
space:
mode:
Diffstat (limited to 'misc-utils')
-rw-r--r--misc-utils/lsblk.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c
index 2ad2a4339..3f8a1160f 100644
--- a/misc-utils/lsblk.c
+++ b/misc-utils/lsblk.c
@@ -676,12 +676,13 @@ static int is_removable_device(struct lsblk_device *dev, struct lsblk_device *pa
if (!pc)
goto done;
+ /* dev is partition and parent is whole-disk */
if (pc == parent->sysfs)
- /* dev is partition and parent is whole-disk */
dev->removable = is_removable_device(parent, NULL);
- else
- /* parent is something else, use sysfs parent */
- ul_path_scanf(pc, "removable", "%d", &dev->removable);
+
+ /* parent is something else, use sysfs parent */
+ else if (ul_path_scanf(pc, "removable", "%d", &dev->removable) != 1)
+ dev->removable = 0;
}
done:
if (dev->removable == -1)