summaryrefslogtreecommitdiffstats
path: root/misc-utils/lsblk.c
diff options
context:
space:
mode:
authorKarel Zak2012-06-21 11:58:39 +0200
committerKarel Zak2012-06-21 11:58:39 +0200
commit9c53a49c44f77022f10301cf4659a5629156a2e8 (patch)
tree4167a074add0f97b37e7e647031424a9f2076566 /misc-utils/lsblk.c
parenttests: add lscpu test for box with 64 CPUs (diff)
downloadkernel-qcow2-util-linux-9c53a49c44f77022f10301cf4659a5629156a2e8.tar.gz
kernel-qcow2-util-linux-9c53a49c44f77022f10301cf4659a5629156a2e8.tar.xz
kernel-qcow2-util-linux-9c53a49c44f77022f10301cf4659a5629156a2e8.zip
lsblk: check ioctl result [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'misc-utils/lsblk.c')
-rw-r--r--misc-utils/lsblk.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c
index fcc1acffa..53b59d225 100644
--- a/misc-utils/lsblk.c
+++ b/misc-utils/lsblk.c
@@ -470,7 +470,8 @@ static int is_readonly_device(struct blkdev_cxt *cxt)
/* fallback if "ro" attribute does not exist */
fd = open(cxt->filename, O_RDONLY);
if (fd != -1) {
- ioctl(fd, BLKROGET, &ro);
+ if (ioctl(fd, BLKROGET, &ro) != 0)
+ ro = 0;
close(fd);
}
return ro;