From: Peter De Wachter Date: Sat, 5 Sep 2009 19:19:56 +0000 (+0200) Subject: mkswap: unbreak -c ("check") option. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=adda7f7ecd53eef1074d8ea531b635c322507a7f;p=util-linux 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 --- diff --git a/disk-utils/mkswap.c b/disk-utils/mkswap.c index bb97210e..bdfa8f7a 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"));