From: Karel Zak Date: Thu, 18 Apr 2013 09:36:09 +0000 (+0200) Subject: libblkid: make swap detection arch independent X-Git-Tag: v2.23~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fa86784f140f4d5d21239ab5b733280f55aa5902;p=thirdparty%2Futil-linux.git libblkid: make swap detection arch independent Signed-off-by: Karel Zak --- diff --git a/libblkid/src/superblocks/swap.c b/libblkid/src/superblocks/swap.c index 7ac119beda..17f07255ce 100644 --- a/libblkid/src/superblocks/swap.c +++ b/libblkid/src/superblocks/swap.c @@ -51,6 +51,17 @@ static int swap_set_info(blkid_probe pr, const char *version) (hdr->version != 1 || hdr->lastpage == 0)) return -1; + if (strcmp(version, "2") == 0) { + if (hdr->version != 1 && swab32(hdr->version) != 1) { + DBG(LOWPROBE, blkid_debug("incorrect swap version")); + return -1; + } + if (hdr->lastpage == 0) { + DBG(LOWPROBE, blkid_debug("not set last swap page")); + return -1; + } + } + /* arbitrary sanity check.. is there any garbage down there? */ if (hdr->padding[32] == 0 && hdr->padding[33] == 0) { if (hdr->volume[0] && blkid_probe_set_label(pr, hdr->volume,