diff --git a/lib/blkid/probe.c b/lib/blkid/probe.c index 05b2d227..d8457a86 100644 --- a/lib/blkid/probe.c +++ b/lib/blkid/probe.c @@ -845,8 +845,7 @@ static int probe_swap1(struct blkid_probe *probe, /* check for wrong version or zeroed pagecount, for sanity */ if (!memcmp(id->bim_magic, "SWAPSPACE2", id->bim_len) && - (blkid_le32(sws->sws_version) != 1 || - sws->sws_lastpage == 0)) + (sws->sws_version != 1 || sws->sws_lastpage == 0)) return 1; /* arbitrary sanity check.. is there any garbage down there? */ diff --git a/lib/blkid/test_probe.in b/lib/blkid/test_probe.in index ce8c42f1..4051c17b 100644 --- a/lib/blkid/test_probe.in +++ b/lib/blkid/test_probe.in @@ -20,6 +20,12 @@ do continue fi bunzip2 < $SRCDIR/tests/$i.img.bz2 > tests/tmp/test.img.$$ + # swap is native-endian, so regenerate before testing + if [ "$i" == "swap0" ]; then + mkswap -v0 tests/tmp/test.img.$$ > /dev/null + elif [ "$i" == "swap1" ]; then + mkswap -v1 -L SWAP-TEST -U 8ff8e77f-8553-485e-8656-58be67a81666 tests/tmp/test.img.$$ >/dev/null + fi ./tst_probe tests/tmp/test.img.$$ > tests/$i.out /bin/rm -f tests/tmp/test.img.$$ tests/$i.ok tests/$i.failed cmp -s tests/$i.out $SRCDIR/tests/$i.results