summaryrefslogtreecommitdiffstats
path: root/disk-utils/mkswap.c
diff options
context:
space:
mode:
authorKarel Zak2012-12-20 20:00:11 +0100
committerKarel Zak2012-12-20 20:00:11 +0100
commitf3b16286424494e76e6cbfff4468cd55cd3f68eb (patch)
tree28c36416447bd8a65d0f16256f6050563c609c32 /disk-utils/mkswap.c
parentlslocks: fix compiler warnings (diff)
downloadkernel-qcow2-util-linux-f3b16286424494e76e6cbfff4468cd55cd3f68eb.tar.gz
kernel-qcow2-util-linux-f3b16286424494e76e6cbfff4468cd55cd3f68eb.tar.xz
kernel-qcow2-util-linux-f3b16286424494e76e6cbfff4468cd55cd3f68eb.zip
mkswap: fix compiler warnings
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'disk-utils/mkswap.c')
-rw-r--r--disk-utils/mkswap.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/disk-utils/mkswap.c b/disk-utils/mkswap.c
index 0144921e7..415a9859b 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++;
}