diff options
author | Karel Zak | 2019-05-23 12:31:49 +0200 |
---|---|---|
committer | Karel Zak | 2019-05-23 12:31:49 +0200 |
commit | 74152bf944837cb095c46fb4d3757086a0b94f64 (patch) | |
tree | de377715725dfd3ab47ad37f0a8e84df25f79a9b /misc-utils | |
parent | lsblk: check stat() return code [coverity scan] (diff) | |
download | kernel-qcow2-util-linux-74152bf944837cb095c46fb4d3757086a0b94f64.tar.gz kernel-qcow2-util-linux-74152bf944837cb095c46fb4d3757086a0b94f64.tar.xz kernel-qcow2-util-linux-74152bf944837cb095c46fb4d3757086a0b94f64.zip |
lsblk: check ul_path_scanf() return value [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'misc-utils')
-rw-r--r-- | misc-utils/lsblk.c | 9 |
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) |