]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lsblk: check ioctl result [coverity scan]
authorKarel Zak <kzak@redhat.com>
Thu, 21 Jun 2012 09:58:39 +0000 (11:58 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 21 Jun 2012 09:58:39 +0000 (11:58 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/lsblk.c

index fcc1acffaeb155f44ed0c2f62c5eea1054a9eeeb..53b59d225cbf67c1ecd866afeaa8397b556d1f95 100644 (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;