lsblk: check ioctl result [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2012-06-21 11:58:39 +02:00
parent 1a07cccf86
commit 9c53a49c44
1 changed files with 2 additions and 1 deletions

View File

@ -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;