lsblk: check ioctl result [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
1a07cccf86
commit
9c53a49c44
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue