From: Karel Zak Date: Thu, 20 Dec 2012 19:00:11 +0000 (+0100) Subject: mkswap: fix compiler warnings X-Git-Tag: v2.23-rc1~390 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f3b16286424494e76e6cbfff4468cd55cd3f68eb;p=thirdparty%2Futil-linux.git mkswap: fix compiler warnings Signed-off-by: Karel Zak --- diff --git a/disk-utils/mkswap.c b/disk-utils/mkswap.c index 0144921e7e..415a9859ba 100644 --- a/disk-utils/mkswap.c +++ b/disk-utils/mkswap.c @@ -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++; }