From: Karel Zak Date: Mon, 4 Nov 2013 08:59:54 +0000 (+0100) Subject: libblkid: fix swap-area version X-Git-Tag: v2.25-rc1~782 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=50cb6c0e27edaa04d40d91536d64a7e3218a6335;p=thirdparty%2Futil-linux.git libblkid: fix swap-area version * v1: hdr->version = 1, magic string = SWAPSPACE2 * v0: no versio in header, magic string = SWAP-SPACE The mistake has been introduced in the old udev volume_id binary where the version was set according to magic string. Reported-by: Phillip Susi Signed-off-by: Karel Zak --- diff --git a/libblkid/src/superblocks/swap.c b/libblkid/src/superblocks/swap.c index 679c818045..4297a9c405 100644 --- a/libblkid/src/superblocks/swap.c +++ b/libblkid/src/superblocks/swap.c @@ -47,7 +47,7 @@ static int swap_set_info(blkid_probe pr, const char *version) return -1; /* SWAPSPACE2 - check for wrong version or zeroed pagecount */ - if (strcmp(version, "2") == 0) { + if (strcmp(version, "1") == 0) { if (hdr->version != 1 && swab32(hdr->version) != 1) { DBG(LOWPROBE, blkid_debug("incorrect swap version")); return -1; @@ -88,11 +88,11 @@ static int probe_swap(blkid_probe pr, const struct blkid_idmag *mag) if (!memcmp(mag->magic, "SWAP-SPACE", mag->len)) { /* swap v0 doesn't support LABEL or UUID */ - blkid_probe_set_version(pr, "1"); + blkid_probe_set_version(pr, "0"); return 0; } else if (!memcmp(mag->magic, "SWAPSPACE2", mag->len)) - return swap_set_info(pr, "2"); + return swap_set_info(pr, "1"); return -1; }