]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
mkswap: fix compiler warnings
authorKarel Zak <kzak@redhat.com>
Thu, 20 Dec 2012 19:00:11 +0000 (20:00 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 20 Dec 2012 19:00:11 +0000 (20:00 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
disk-utils/mkswap.c

index 0144921e7ea3be9ca3695c2c6b3eb028462e45b5..415a9859ba822ce3c34181d2690e3e977693fe98 100644 (file)
@@ -316,10 +316,16 @@ check_blocks(void)
        buffer = xmalloc(pagesize);
        current_page = 0;
        while (current_page < PAGES) {
+
+               ssize_t rc;
+
                if (do_seek && lseek(DEV,current_page*pagesize,SEEK_SET) !=
                    current_page*pagesize)
                        errx(EXIT_FAILURE, _("seek failed in check_blocks"));
-               if ((do_seek = (pagesize != read(DEV, buffer, pagesize))))
+
+               rc = read(DEV, buffer, pagesize);
+               do_seek = (rc < 0 || (size_t) rc != pagesize);
+               if (do_seek)
                        page_bad(current_page);
                current_page++;
        }