summaryrefslogtreecommitdiffstats
path: root/disk-utils/mkswap.c
diff options
context:
space:
mode:
authorPeter De Wachter2009-09-05 21:19:56 +0200
committerKarel Zak2009-09-07 08:49:19 +0200
commitadda7f7ecd53eef1074d8ea531b635c322507a7f (patch)
tree835c85c3b10d3fb20ad556be47930f10ddcf4771 /disk-utils/mkswap.c
parentlibblkid: fix buffer overflow in blkid_encode_string() (diff)
downloadkernel-qcow2-util-linux-adda7f7ecd53eef1074d8ea531b635c322507a7f.tar.gz
kernel-qcow2-util-linux-adda7f7ecd53eef1074d8ea531b635c322507a7f.tar.xz
kernel-qcow2-util-linux-adda7f7ecd53eef1074d8ea531b635c322507a7f.zip
mkswap: unbreak -c ("check") option.
In the check_blocks() loop, current_page is not incremented. Because of this bug, the loop does not end when the end of the device is reached. Instead it tries to continue reading, which of course fails, and eventually mkswap aborts ("too many bad pages"). Note that this can only be tested with swap partitions, mkswap ignores the -c option for swap files. Signed-off-by: Peter De Wachter <pdewacht@gmail.com>
Diffstat (limited to 'disk-utils/mkswap.c')
-rw-r--r--disk-utils/mkswap.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/disk-utils/mkswap.c b/disk-utils/mkswap.c
index bb97210ec..bdfa8f7a9 100644
--- a/disk-utils/mkswap.c
+++ b/disk-utils/mkswap.c
@@ -309,9 +309,9 @@ check_blocks(void) {
current_page*pagesize)
die(_("seek failed in check_blocks"));
if ((do_seek = (pagesize != read(DEV, buffer, pagesize)))) {
- page_bad(current_page++);
- continue;
+ page_bad(current_page);
}
+ current_page++;
}
if (badpages == 1)
printf(_("one bad page\n"));