diff options
author | Karel Zak | 2013-11-04 09:59:54 +0100 |
---|---|---|
committer | Karel Zak | 2013-11-04 09:59:54 +0100 |
commit | 50cb6c0e27edaa04d40d91536d64a7e3218a6335 (patch) | |
tree | 0f975d392f2acbbd81ab07ed2d85720d4aa6daf8 | |
parent | libfdisk: (sun) fix end sectors with +1 error (diff) | |
download | kernel-qcow2-util-linux-50cb6c0e27edaa04d40d91536d64a7e3218a6335.tar.gz kernel-qcow2-util-linux-50cb6c0e27edaa04d40d91536d64a7e3218a6335.tar.xz kernel-qcow2-util-linux-50cb6c0e27edaa04d40d91536d64a7e3218a6335.zip |
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 <psusi@ubuntu.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r-- | libblkid/src/superblocks/swap.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libblkid/src/superblocks/swap.c b/libblkid/src/superblocks/swap.c index 679c81804..4297a9c40 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; } |