summaryrefslogtreecommitdiffstats
path: root/misc-utils
diff options
context:
space:
mode:
authorKarel Zak2019-05-23 12:28:13 +0200
committerKarel Zak2019-05-23 12:28:13 +0200
commit404eef654af165df90fe4e82ae74021711ae8c1f (patch)
treeeaa72d0897f8bcd719fbda8a75e9ce710fe95f6a /misc-utils
parentlogger: make code more robust for static analyzer [clang scan] (diff)
downloadkernel-qcow2-util-linux-404eef654af165df90fe4e82ae74021711ae8c1f.tar.gz
kernel-qcow2-util-linux-404eef654af165df90fe4e82ae74021711ae8c1f.tar.xz
kernel-qcow2-util-linux-404eef654af165df90fe4e82ae74021711ae8c1f.zip
lsblk: check stat() return code [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'misc-utils')
-rw-r--r--misc-utils/lsblk.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c
index 30d5d9b4e..2ad2a4339 100644
--- a/misc-utils/lsblk.c
+++ b/misc-utils/lsblk.c
@@ -655,8 +655,9 @@ static char *get_vfs_attribute(struct lsblk_device *dev, int id)
static struct stat *device_get_stat(struct lsblk_device *dev)
{
- if (!dev->st.st_rdev)
- stat(dev->filename, &dev->st);
+ if (!dev->st.st_rdev
+ && stat(dev->filename, &dev->st) != 0)
+ return NULL;
return &dev->st;
}