fix endian issue on patch

This commit is contained in:
Eric Sandeen 2008-04-18 15:24:31 +00:00
parent e1926bddf9
commit 6bdb0de51a

View File

@ -27,13 +27,14 @@ index 45885c3..a070201 100644
unsigned char *buf __BLKID_ATTR((unused)))
{
struct swap_id_block *sws;
@@ -843,6 +843,11 @@ static int probe_swap1(struct blkid_probe *probe,
@@ -843,6 +843,12 @@ static int probe_swap1(struct blkid_probe *probe,
if (!sws)
return 1;
+ /* check for wrong version or zeroed pagecount, for sanity */
+ if (!memcmp(id->bim_magic, "SWAPSPACE2", id->bim_len) &&
+ (sws->sws_version != 1 || sws->sws_lastpage == 0))
+ (blkid_le32(sws->sws_version) != 1 ||
+ sws->sws_lastpage == 0))
+ return 1;
+
/* arbitrary sanity check.. is there any garbage down there? */